This commit is contained in:
Ruben Blanco 2023-10-18 14:39:33 +02:00
parent e9a9533a14
commit b23f0c01e0
1 changed files with 5 additions and 4 deletions

View File

@ -7,18 +7,19 @@
- name: Gather the package facts - name: Gather the package facts
ansible.builtin.package_facts: ansible.builtin.package_facts:
manager: auto manager: auto
register: packages
# print the package facts in var # print the package facts in var
- name: print the package facts in var #- name: print the package facts in var
ansible.builtin.debug: # ansible.builtin.debug:
var: ansible_facts.packages # var: ansible_facts.packages
# install packages if is not in the system # install packages if is not in the system
- name: install fail2ban package if is not in the system - name: install fail2ban package if is not in the system
apt: apt:
name: fail2ban name: fail2ban
state: present state: present
when: "{{ ansible_facts.packages['fail2ban'] }} is not defined " when: "{{ packages['fail2ban'] }} is not defined "
# config fail2ban if is there is in the system # config fail2ban if is there is in the system
#- name: config fail2ban #- name: config fail2ban