manage_apt_packages/tasks/main.yml

17 lines
533 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: 3600
- name: "Install/remove required packages"
ansible.builtin.apt:
name: "{{ item.name }}{% if item.version not in [None, '', 'latest'] %}={{ item.version }}{% endif %}"
state: "{{ item.state }}"
allow_downgrade:
loop: "{{ manage_apt_packages_list }}"
when: manage_apt_packages_list is defined
and manage_apt_packages_list not in [None, '']
notify: "apt-autoremove"