Reboot system after initial ansible-run
This commit is contained in:
parent
37b8b94c9d
commit
b807d2142e
2 changed files with 16 additions and 0 deletions
4
roles/lmn_finish/handlers/main.yml
Normal file
4
roles/lmn_finish/handlers/main.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: Reboot client
|
||||
ansible.builtin.command:
|
||||
cmd: "shutdown -r -t 60"
|
||||
|
|
@ -29,6 +29,18 @@
|
|||
- "{{ extra_pkgs_bpo2 }}"
|
||||
when: extra_pkgs_bpo | length > 0 or extra_pkgs_bpo1 | length > 0 or extra_pkgs_bpo2 | length > 0
|
||||
|
||||
|
||||
- name: Check if former ansible-stamp exists
|
||||
ansible.builtin.stat:
|
||||
path: /var/local/ansible-stamps
|
||||
register: stamp_exists
|
||||
|
||||
- name: Trigger Reboot if no former ansible-run is found
|
||||
ansible.builtin.debug:
|
||||
msg: "First Ansible-Run on Client - Reboot handler started"
|
||||
changed_when: not stamp_exists.stat.exists
|
||||
notify: "Reboot client"
|
||||
|
||||
- name: Timestamp successfull run and send up-to-date report
|
||||
ansible.builtin.shell:
|
||||
cmd: date --iso-8601=seconds >> /var/local/ansible-stamps && /usr/local/sbin/reporter
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue