-
Notifications
You must be signed in to change notification settings - Fork 0
/
PATCH_REBOOT.yml
38 lines (33 loc) · 965 Bytes
/
PATCH_REBOOT.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
---
- name: Patch the workstations and Reboot
hosts: workstations
tasks:
- name: Patch the server
become: yes
become_method: sudo
tags: Patch
shell: "dnf -y update"
register: patchresult
- name: Update Flatpaks
shell: "flatpak update -y"
register: patchresult
- name: Reboot the server
tags: reboot
become: yes
become_method: sudo
shell: "sleep 5 && reboot"
async: 1
poll: 0
- name: Wait for the reboot and reconnect
wait_for:
port: 22
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
search_regex: OpenSSH
delay: 60
timeout: 120
connection: local
- name: Check the Uptime of the workstations
shell: "uptime"
register: Uptime
- debug: var=Uptime
- debug: var=patchresult