๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/tasks/install_packages.yml

40 lines
1.0 KiB

- name: validate input
fail:
msg: package must be a list or a string
when: (package is not defined) or (package is mapping) or
(package is not iterable) and (package is not string)
- block:
- name: determine distribution
setup:
gather_subset:
- min
- name: fail if distribution is not yet defined
fail:
msg: distribution is not yet defined, using fallback
when: ansible_distribution is not defined
rescue:
- name: set fallback distribution
set_fact:
ansible_distribution: 'Alpine'
ansible_system: "{{ 'Win32NT' if (is_windows | d(false) == true) else 'Linux' }}"
when: ansible_distribution is not defined
- name: loop over packages
include_tasks: tasks/includes/package.yml
loop: "{%- if package is string -%}{{ [ package ] }}\
{%- else -%}{{ package }}\
{%- endif -%}"
loop_control:
loop_var: package_inner
- name: undefine temporary facts
set_fact:
this_package: "{{ None }}"
when: this_package | d(None) != None