-
Notifications
You must be signed in to change notification settings - Fork 15
/
pkgs_full_update.yml
57 lines (52 loc) · 1.53 KB
/
pkgs_full_update.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
---
- name: Apply all available package updates
hosts: "{{ rhel_inventory_group | default(omit) }}"
# gather_facts: true
gather_facts: false
become: true
strategy: free
tasks:
# - name: Wait for connection...
# ansible.builtin.wait_for_connection:
# connect_timeout: 20
# sleep: 5
# delay: 5
# timeout: 300
- name: Wait for connection...and gather facts
ansible.builtin.setup:
gather_timeout: 60
register: setup_result
ignore_errors: true
until: "setup_result is not failed"
retries: 10
delay: 10
- name: Update RHEL 7 OS to latest packages available
ansible.builtin.yum:
name: '*'
state: latest
when: ansible_distribution_major_version | int == 7
- name: Update RHEL 8/9 OS to latest packages available
when: ansible_distribution_major_version | int >= 8
block:
- name: Update current release version
when: release_version is defined
ansible.builtin.template:
src: rhel/yum/releasever.j2
dest: /etc/yum/vars/releasever
owner: root
group: root
mode: '0644'
- name: Update to latest packages
ansible.builtin.dnf:
name: '*'
state: latest
- name: Reboot node
ansible.builtin.reboot:
register: reboot_result
- name: Wait for connection...
ansible.builtin.wait_for_connection:
connect_timeout: 20
sleep: 5
delay: 5
timeout: 300
...