-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.yml
More file actions
42 lines (35 loc) · 1.28 KB
/
patch.yml
File metadata and controls
42 lines (35 loc) · 1.28 KB
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
---
- hosts: all
become: yes
vars:
use_proxy: no
proxy: '{{ proxy_host|default(omit) }}:{{ proxy_port|default(omit) }}'
proxy_env:
http_proxy: '{{ proxy }}'
https_proxy: '{{ proxy }}'
ftp_proxy: '{{ proxy }}'
no_proxy: '{{ no_proxy_list | default(omit) }}'
tasks:
- name: update all packages on all Oracle Linux 8 systems
ansible.builtin.dnf:
name: "*"
state: latest
when: ansible_distribution == 'OracleLinux' and (ansible_facts['distribution_version'] is version('8', '>='))
- name: update all packages on all Oracle Linux 9 systems
ansible.builtin.dnf:
name: "*"
state: latest
when: ansible_distribution == 'OracleLinux' and (ansible_facts['distribution_version'] is version('9', '>='))
- name: check if reboot required
command: /usr/bin/needs-restarting -r
register: reboot_required
ignore_errors: yes
changed_when: false
failed_when: reboot_required.rc == 2
when: ansible_distribution == 'OracleLinux'
- debug:
var: reboot_required
- name: reboot (if needed) to apply latest kernel and updates
reboot:
when: ansible_distribution == 'OracleLinux' and reboot_required.rc == 1
environment: "{{ proxy_env | default(omit) }}"