-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
62 lines (50 loc) · 1.55 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
- hosts: all
# serial: 1
gather_facts: true
become: yes
tasks:
#RHEL
- name: RHEL - list security updates
yum:
list: security
register: rhel_result
when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat'
- debug:
var: rhel_result
# verbosity: 1
when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat'
- name: RHEL - install security updates
yum:
name: '*'
security: yes
state: latest
become: true
become_user: root
become_method: sudo
when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat'
#UBUNTU
- name: DEB - update apt list
apt:
update_cache: yes
become: true
become_user: root
become_method: sudo
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: DEB - Make a copy of security repos
shell: cat /etc/apt/sources.list|grep secu >/etc/apt/security.sources.list
become: true
become_user: root
become_method: sudo
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: DEB - Install security updates
shell: apt-get upgrade -oDir::Etc::SourceList=/etc/apt/security.sources.list --force-yes -y
become: true
become_user: root
become_method: sudo
register: deb_result
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- debug:
var: deb_result
# verbosity: 1
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'