Genericize the roal to look like the rest
This commit is contained in:
parent
fe3c5c948f
commit
580805bc34
16
tasks/Debian-default.yml
Normal file
16
tasks/Debian-default.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
# tasks file for ensure_os_patch
|
||||||
|
- name: 'ensure Debian patch'
|
||||||
|
when:
|
||||||
|
- ansible_system == 'Linux'
|
||||||
|
- ansible_pkg_mgr == 'apt'
|
||||||
|
ansible.builtin.apt:
|
||||||
|
autoclean: 'yes'
|
||||||
|
autoremove: 'yes'
|
||||||
|
upgrade: 'dist'
|
||||||
|
notify:
|
||||||
|
- 'ensure_os_patch.package_facts'
|
||||||
|
- 'ensure_os_patch.service_facts'
|
||||||
|
- name: 'flush handlers'
|
||||||
|
meta: 'flush_handlers'
|
||||||
|
|
3
tasks/default.yml
Normal file
3
tasks/default.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
# tasks file for ensure_os_patch
|
||||||
|
|
100
tasks/main.yml
100
tasks/main.yml
@ -1,5 +1,42 @@
|
|||||||
---
|
---
|
||||||
# tasks file for ensure_os_patch
|
# tasks file for ensure_os_patch
|
||||||
|
- name: 'include vendor / version specific tasks'
|
||||||
|
when:
|
||||||
|
- ansible_system == 'Linux'
|
||||||
|
include_tasks:
|
||||||
|
file: '{{ lookup("first_found", findme ) }}'
|
||||||
|
vars:
|
||||||
|
findme:
|
||||||
|
files:
|
||||||
|
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
|
||||||
|
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-default.yml'
|
||||||
|
- '{{ ansible_distribution }}-default.yml'
|
||||||
|
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
|
||||||
|
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-default.yml'
|
||||||
|
- '{{ ansible_os_family }}-default.yml'
|
||||||
|
- 'default.yml'
|
||||||
|
errors: 'ignore'
|
||||||
|
- name: 'flush handlers'
|
||||||
|
meta: 'flush_handlers'
|
||||||
|
- name: 'include variables'
|
||||||
|
when:
|
||||||
|
- ansible_system == 'Linux'
|
||||||
|
include_vars:
|
||||||
|
file: '{{ lookup("first_found", findme ) }}'
|
||||||
|
name: 'ensure_os_patch'
|
||||||
|
vars:
|
||||||
|
findme:
|
||||||
|
files:
|
||||||
|
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
|
||||||
|
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-default.yml'
|
||||||
|
- '{{ ansible_distribution }}-default.yml'
|
||||||
|
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
|
||||||
|
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-default.yml'
|
||||||
|
- '{{ ansible_os_family }}-default.yml'
|
||||||
|
- 'default.yml'
|
||||||
|
paths:
|
||||||
|
- '../vars/'
|
||||||
|
errors: 'ignore'
|
||||||
- name: 'package discovery'
|
- name: 'package discovery'
|
||||||
when:
|
when:
|
||||||
- ansible_system == 'Linux'
|
- ansible_system == 'Linux'
|
||||||
@ -10,20 +47,25 @@
|
|||||||
- ansible_system == 'Linux'
|
- ansible_system == 'Linux'
|
||||||
- services is not defined
|
- services is not defined
|
||||||
ansible.builtin.service_facts:
|
ansible.builtin.service_facts:
|
||||||
- name: 'ensure patch'
|
- name: 'ensure packages'
|
||||||
when:
|
when:
|
||||||
- ansible_system == 'Linux'
|
- ansible_system == 'Linux'
|
||||||
- ansible_pkg_mgr == 'dnf' or
|
- ensure_os_patch is defined
|
||||||
ansible_pkg_mgr == 'yum'
|
- ensure_os_patch.package_list is defined
|
||||||
|
- ensure_os_patch.package_list is iterable
|
||||||
|
- packages[item.name] is not defined
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name: '*'
|
name: '{{ item.name }}'
|
||||||
state: 'latest'
|
state: '{{ item.state }}'
|
||||||
async: 900
|
loop: '{{ ensure_os_patch.package_list }}'
|
||||||
poll: 5
|
loop_control:
|
||||||
|
label: '{{ item.name }} will be {{ item.state }}'
|
||||||
notify:
|
notify:
|
||||||
- 'ensure_os_patch.package_facts'
|
- 'ensure_os_patch.package_facts'
|
||||||
- 'ensure_os_patch.service_facts'
|
- 'ensure_os_patch.service_facts'
|
||||||
- name: 'ensure patch'
|
- name: 'flush handlers'
|
||||||
|
meta: 'flush_handlers'
|
||||||
|
- name: 'ensure Debian patch'
|
||||||
when:
|
when:
|
||||||
- ansible_system == 'Linux'
|
- ansible_system == 'Linux'
|
||||||
- ansible_pkg_mgr == 'apt'
|
- ansible_pkg_mgr == 'apt'
|
||||||
@ -31,42 +73,24 @@
|
|||||||
autoclean: 'yes'
|
autoclean: 'yes'
|
||||||
autoremove: 'yes'
|
autoremove: 'yes'
|
||||||
upgrade: 'dist'
|
upgrade: 'dist'
|
||||||
async: 900
|
|
||||||
poll: 5
|
|
||||||
notify:
|
notify:
|
||||||
- 'ensure_os_patch.package_facts'
|
- 'ensure_os_patch.package_facts'
|
||||||
- 'ensure_os_patch.service_facts'
|
- 'ensure_os_patch.service_facts'
|
||||||
- name: 'Ensure dnf-automatic installation'
|
- name: 'flush handlers'
|
||||||
|
meta: 'flush_handlers'
|
||||||
|
- name: 'ensure services'
|
||||||
when:
|
when:
|
||||||
- ansible_system == 'Linux'
|
- ansible_system == 'Linux'
|
||||||
- (
|
- ensure_os_patch is defined
|
||||||
ansible_distribution == 'Fedora' and
|
- ensure_os_patch.service_list is defined
|
||||||
ansible_distribution_major_version is version('21', '>=')
|
- ensure_os_patch.service_list is iterable
|
||||||
) or (
|
|
||||||
ansible_distribution == 'CentOS' and
|
|
||||||
ansible_distribution_major_version is version('8', '>=')
|
|
||||||
)
|
|
||||||
ansible.builtin.package:
|
|
||||||
name:
|
|
||||||
- 'dnf-automatic'
|
|
||||||
state: 'present'
|
|
||||||
notify:
|
|
||||||
- 'ensure_os_patch.package_facts'
|
|
||||||
- 'ensure_os_patch.service_facts'
|
|
||||||
- name: 'Ensure dnf-automatic runs'
|
|
||||||
when:
|
|
||||||
- ansible_system == 'Linux'
|
|
||||||
- (
|
|
||||||
ansible_distribution == 'Fedora' and
|
|
||||||
ansible_distribution_major_version is version('21', '>=')
|
|
||||||
) or (
|
|
||||||
ansible_distribution == 'CentOS' and
|
|
||||||
ansible_distribution_major_version is version('8', '>=')
|
|
||||||
)
|
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
enabled: 'yes'
|
enabled: '{{ item.enabled }}'
|
||||||
name: 'dnf-automatic-install.timer'
|
name: '{{ item.name }}'
|
||||||
state: 'started'
|
state: '{{ item.state }}'
|
||||||
|
loop: '{{ ensure_os_patch.service_list }}'
|
||||||
|
loop_control:
|
||||||
|
label: '{{ item.name }} will be {{ item.state }}'
|
||||||
notify:
|
notify:
|
||||||
- 'ensure_os_patch.package_facts'
|
- 'ensure_os_patch.package_facts'
|
||||||
- 'ensure_os_patch.service_facts'
|
- 'ensure_os_patch.service_facts'
|
||||||
|
6
vars/CentOS-6-default.yml
Normal file
6
vars/CentOS-6-default.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
|
6
vars/CentOS-7-default.yml
Normal file
6
vars/CentOS-7-default.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
|
12
vars/CentOS-8-default.yml
Normal file
12
vars/CentOS-8-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-21-default.yml
Normal file
12
vars/Fedora-21-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-22-default.yml
Normal file
12
vars/Fedora-22-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-23-default.yml
Normal file
12
vars/Fedora-23-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-24-default.yml
Normal file
12
vars/Fedora-24-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-25-default.yml
Normal file
12
vars/Fedora-25-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-26-default.yml
Normal file
12
vars/Fedora-26-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-27-default.yml
Normal file
12
vars/Fedora-27-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-28-default.yml
Normal file
12
vars/Fedora-28-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-29-default.yml
Normal file
12
vars/Fedora-29-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-30-default.yml
Normal file
12
vars/Fedora-30-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-31-default.yml
Normal file
12
vars/Fedora-31-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-32-default.yml
Normal file
12
vars/Fedora-32-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-33-default.yml
Normal file
12
vars/Fedora-33-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
12
vars/Fedora-34-default.yml
Normal file
12
vars/Fedora-34-default.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
||||||
|
package_list:
|
||||||
|
- name: 'dnf-automatic'
|
||||||
|
state: 'present'
|
||||||
|
- name: '*'
|
||||||
|
state: 'latest'
|
||||||
|
service_list:
|
||||||
|
- name: 'dnf-automatic.timer'
|
||||||
|
state: 'started'
|
||||||
|
enabled: 'yes'
|
||||||
|
|
2
vars/default.yml
Normal file
2
vars/default.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for ensure_os_patch
|
Loading…
x
Reference in New Issue
Block a user