|
5 | 5 | name: auditd
|
6 | 6 | enabled: true
|
7 | 7 | when:
|
8 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 8 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
9 | 9 |
|
10 | 10 | - name: Generate auditd rules
|
11 | 11 | become: true
|
|
21 | 21 | name: systemd-sysctl
|
22 | 22 | state: restarted
|
23 | 23 | when:
|
24 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 24 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
25 | 25 |
|
26 | 26 | - name: Reload systemd
|
27 | 27 | become: true
|
28 | 28 | ansible.builtin.systemd_service:
|
29 | 29 | daemon_reload: true
|
30 | 30 | when:
|
31 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 31 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
32 | 32 |
|
33 | 33 | - name: Run rkhunter propupd
|
34 | 34 | become: true
|
|
48 | 48 | failed_when:
|
49 | 49 | - rkhunter_update.rc == 1
|
50 | 50 | when:
|
51 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 51 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
52 | 52 |
|
53 | 53 | - name: Enable aidecheck
|
54 | 54 | become: true
|
|
57 | 57 | enabled: true
|
58 | 58 | state: started
|
59 | 59 | when:
|
60 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 60 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
61 | 61 |
|
62 | 62 | - name: Disable aidecheck
|
63 | 63 | become: true
|
|
66 | 66 | state: stopped
|
67 | 67 | enabled: false
|
68 | 68 | when:
|
69 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 69 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
70 | 70 |
|
71 | 71 | - name: Mask aidecheck
|
72 | 72 | become: true
|
|
76 | 76 | state: stopped
|
77 | 77 | enabled: false
|
78 | 78 | when:
|
79 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 79 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
80 | 80 |
|
81 | 81 | - name: Restart ssh service
|
82 | 82 | become: true
|
|
88 | 88 | - ssh_service is not success
|
89 | 89 | - not 'Could not find the requested service' in ssh_service.msg
|
90 | 90 | when:
|
91 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 91 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
92 | 92 |
|
93 | 93 | - name: Restart sshd service
|
94 | 94 | become: true
|
|
100 | 100 | - sshd_service is not success
|
101 | 101 | - not 'Could not find the requested service' in sshd_service.msg
|
102 | 102 | when:
|
103 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 103 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
104 | 104 |
|
105 | 105 | - name: Restart Postfix
|
106 | 106 | become: true
|
107 | 107 | ansible.builtin.service:
|
108 | 108 | name: postfix
|
109 | 109 | state: restarted
|
110 | 110 | when:
|
111 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 111 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
112 | 112 |
|
113 | 113 | - name: Run apt-get autoremove
|
114 | 114 | become: true
|
|
129 | 129 | enabled: false
|
130 | 130 | state: stopped
|
131 | 131 | when:
|
132 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 132 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
133 | 133 |
|
134 | 134 | - name: Run dnf autoremove
|
135 | 135 | become: true
|
136 | 136 | ansible.builtin.dnf:
|
137 | 137 | autoremove: true
|
138 | 138 | when:
|
139 |
| - - ansible_os_family == "RedHat" |
| 139 | + - ansible_facts.os_family == "RedHat" |
140 | 140 | tags:
|
141 | 141 | - dnf
|
142 | 142 | - packages
|
|
153 | 153 | register: update_debian_cracklib
|
154 | 154 | changed_when: update_debian_cracklib.rc == 0
|
155 | 155 | when:
|
156 |
| - - ansible_os_family == "Debian" |
| 156 | + - ansible_facts.os_family == "Debian" |
157 | 157 |
|
158 | 158 | - name: Update RedHat cracklib
|
159 | 159 | environment:
|
|
164 | 164 | register: update_redhat_cracklib
|
165 | 165 | changed_when: update_redhat_cracklib.rc == 0
|
166 | 166 | when:
|
167 |
| - - ansible_os_family == "RedHat" |
| 167 | + - ansible_facts.os_family == "RedHat" |
168 | 168 |
|
169 | 169 | - name: Update GRUB
|
170 | 170 | become: true
|
|
173 | 173 | register: update_grub
|
174 | 174 | changed_when: update_grub.rc == 0
|
175 | 175 | when:
|
176 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 176 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
177 | 177 |
|
178 | 178 | - name: Update GRUB2
|
179 | 179 | become: true
|
|
182 | 182 | register: update_grub2
|
183 | 183 | changed_when: update_grub2.rc == 0
|
184 | 184 | when:
|
185 |
| - - ansible_virtualization_type not in ["container", "docker", "podman"] |
| 185 | + - ansible_facts.virtualization_type not in ["container", "docker", "podman"] |
186 | 186 |
|
187 | 187 | - name: Validate rsyslogd
|
188 | 188 | become: true
|
|
0 commit comments