Packer.Images/ansible/roles/assets/tasks/dependencies.yml

51 lines
1.4 KiB
YAML
Raw Normal View History

- name: Download & install static binaries
ansible.builtin.get_url:
url: "{{ item.url }}"
url_username: "{{ item.username | default(omit) }}"
url_password: "{{ item.password | default(omit) }}"
2022-06-25 06:33:12 +00:00
dest: /usr/local/bin/{{ item.filename }}
owner: root
group: root
mode: 0755
loop: "{{ dependencies.static_binaries | selectattr('archive', 'undefined') }}"
loop_control:
label: "{{ item.filename }}"
2022-06-25 21:32:29 +00:00
- name: Download, extract & install archived static binaries
include_tasks: dependencies.archive_compressed.yml
loop: "{{ dependencies.static_binaries | rejectattr('archive', 'undefined') | selectattr('archive', 'equalto', 'compressed') }}"
loop_control:
label: "{{ item.filename }}"
- name: Install ansible-galaxy collections
2022-06-24 21:44:10 +00:00
ansible.builtin.shell:
2022-06-25 06:33:12 +00:00
cmd: ansible-galaxy collection install {{ item }}
2022-11-17 10:21:19 +00:00
register: collections
2022-06-24 21:44:10 +00:00
loop: "{{ dependencies.ansible_galaxy_collections }}"
2022-11-17 10:21:19 +00:00
retries: 5
delay: 5
until: collections is not failed
- name: Install distro packages
ansible.builtin.apt:
2022-08-03 12:39:36 +00:00
pkg: "{{ dependencies.packages.apt }}"
state: latest
update_cache: yes
install_recommends: no
- name: Upgrade all packages
ansible.builtin.apt:
2022-06-25 06:33:12 +00:00
name: '*'
state: latest
update_cache: yes
2022-08-03 12:39:36 +00:00
- name: Install additional python packages
ansible.builtin.pip:
name: "{{ dependencies.packages.pip }}"
state: latest
- name: Cleanup apt cache
ansible.builtin.apt:
autoremove: yes
purge: yes