manage_apt_packages/tasks/main.yml

17 lines
542 B
YAML

---
# task/main file for manage_apt_packages
- name: "Update apt caches"
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 3600
- name: "Install/remove required apt packages"
ansible.builtin.apt:
name: "{{ item.name }}{% if item.version not in [None, '', 'latest'] %}={{ item.version }}{% endif %}"
state: "{{ item.state }}"
allow_downgrade: true
loop: "{{ manage_apt_packages_list }}"
when: manage_apt_packages_list is defined
and manage_apt_packages_list not in [None, '']
notify: "apt-autoremove"