changed defaults to be non-breaking, removed allow_downgrade for now

This commit is contained in:
Bertrand Lanson 2023-03-15 22:24:58 +01:00
parent 699c0ca584
commit a3a3d5675b
3 changed files with 5 additions and 8 deletions

View File

@ -1,6 +1,6 @@
---
# defaults file for manage_apt_packages
manage_apt_packages_list:
- name: nginx
- name: vim
version: latest
state: absent
state: present

View File

@ -9,8 +9,6 @@ def test_hosts_file(host):
assert etc_hosts.group == "root"
def test_packages_not_installed(host):
"""Validate nginx and apache2 are not installed"""
apt_package_nginx = host.package("nginx")
apt_package_apache2 = host.package("apache2")
assert not apt_package_nginx.is_installed
assert not apt_package_apache2.is_installed
"""Validate vim is installed"""
apt_package_vim = host.package("vim")
assert apt_package_vim.is_installed

View File

@ -9,7 +9,6 @@
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, '']