manage_apt_packages/tasks/main.yml

19 lines
610 B
YAML
Raw Normal View History

2023-03-10 18:54:35 +00:00
---
# task/main file for manage_apt_packages
- name: "Update apt caches"
ansible.builtin.apt:
update_cache: yes
cache_valid_time: "{{ manage_apt_packages_apt_cache_time }}"
become: true
2023-03-10 18:54:35 +00:00
- name: "Install/remove required apt packages"
2023-03-10 18:54:35 +00:00
ansible.builtin.apt:
name: "{{ item.name }}{% if item.version not in [None, '', 'latest'] %}={{ item.version }}{% endif %}"
state: "{{ item.state }}"
2023-03-15 22:06:23 +00:00
allow_downgrade: true
2023-03-10 18:54:35 +00:00
loop: "{{ manage_apt_packages_list }}"
when: manage_apt_packages_list is defined
and manage_apt_packages_list not in [None, '']
notify: "apt-autoremove"
become: true