Add fail2ban role and clean up yaml lint noise
This commit is contained in:
@@ -1,35 +1,37 @@
|
||||
---
|
||||
# tasks file for ensure_os_patch
|
||||
- name: 'include variables'
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- name: include variables
|
||||
when: ["ansible_facts[\"system\"] == 'Linux'"]
|
||||
ansible.builtin.include_vars:
|
||||
file: '{{ lookup("first_found", findme) }}'
|
||||
name: 'ensure_os_patch'
|
||||
name: ensure_os_patch
|
||||
vars:
|
||||
findme:
|
||||
files:
|
||||
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
|
||||
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
|
||||
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"]
|
||||
}}-{{ ansible_facts["architecture"] }}.yml'
|
||||
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"]
|
||||
}}-default.yml'
|
||||
- '{{ ansible_facts["distribution"] }}-default.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"]
|
||||
}}-{{ ansible_facts["architecture"] }}.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"]
|
||||
}}-default.yml'
|
||||
- '{{ ansible_facts["os_family"] }}-default.yml'
|
||||
- 'default.yml'
|
||||
paths:
|
||||
- '../vars/'
|
||||
errors: 'ignore'
|
||||
- name: 'package discovery'
|
||||
- default.yml
|
||||
paths: [../vars/]
|
||||
errors: ignore
|
||||
- name: package discovery
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ansible_facts["packages"] is not defined
|
||||
ansible.builtin.package_facts:
|
||||
- name: 'service discovery'
|
||||
- name: service discovery
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ansible_facts["services"] is not defined
|
||||
ansible.builtin.service_facts:
|
||||
- name: 'ensure packages'
|
||||
- name: ensure packages
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ensure_os_patch is defined
|
||||
@@ -41,10 +43,8 @@
|
||||
loop: '{{ ensure_os_patch.package_list }}'
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
notify:
|
||||
- 'ensure_os_patch.package_facts'
|
||||
- 'ensure_os_patch.service_facts'
|
||||
- name: 'ensure apt patch'
|
||||
notify: [ensure_os_patch.package_facts, ensure_os_patch.service_facts]
|
||||
- name: ensure apt patch
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ansible_facts["pkg_mgr"] == 'apt'
|
||||
@@ -52,33 +52,27 @@
|
||||
autoclean: 'yes'
|
||||
autoremove: 'yes'
|
||||
update_cache: 'yes'
|
||||
upgrade: 'dist'
|
||||
notify:
|
||||
- 'ensure_os_patch.package_facts'
|
||||
- 'ensure_os_patch.service_facts'
|
||||
- name: 'ensure dnf'
|
||||
upgrade: dist
|
||||
notify: [ensure_os_patch.package_facts, ensure_os_patch.service_facts]
|
||||
- name: ensure dnf
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ansible_facts["pkg_mgr"] == 'dnf'
|
||||
ansible.builtin.dnf:
|
||||
name: '*'
|
||||
state: 'latest'
|
||||
state: latest
|
||||
update_cache: 'yes'
|
||||
notify:
|
||||
- 'ensure_os_patch.package_facts'
|
||||
- 'ensure_os_patch.service_facts'
|
||||
- name: 'ensure dnf5'
|
||||
notify: [ensure_os_patch.package_facts, ensure_os_patch.service_facts]
|
||||
- name: ensure dnf5
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ansible_facts["pkg_mgr"] == 'dnf5'
|
||||
ansible.builtin.dnf5:
|
||||
name: '*'
|
||||
state: 'latest'
|
||||
state: latest
|
||||
update_cache: 'yes'
|
||||
notify:
|
||||
- 'ensure_os_patch.package_facts'
|
||||
- 'ensure_os_patch.service_facts'
|
||||
- name: 'ensure services'
|
||||
notify: [ensure_os_patch.package_facts, ensure_os_patch.service_facts]
|
||||
- name: ensure services
|
||||
when:
|
||||
- ansible_facts["system"] == 'Linux'
|
||||
- ensure_os_patch is defined
|
||||
@@ -91,10 +85,6 @@
|
||||
loop: '{{ ensure_os_patch.service_list }}'
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
notify:
|
||||
- 'ensure_os_patch.package_facts'
|
||||
- 'ensure_os_patch.service_facts'
|
||||
- name: 'flush handlers'
|
||||
ansible.builtin.meta: 'flush_handlers'
|
||||
...
|
||||
|
||||
notify: [ensure_os_patch.package_facts, ensure_os_patch.service_facts]
|
||||
- name: flush handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
Reference in New Issue
Block a user