Reboot system after initial ansible-run

This commit is contained in:
Raphael Dannecker 2025-12-15 11:55:20 +01:00
parent 37b8b94c9d
commit b807d2142e
2 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1,4 @@
---
- name: Reboot client
ansible.builtin.command:
cmd: "shutdown -r -t 60"

View file

@ -29,6 +29,18 @@
- "{{ extra_pkgs_bpo2 }}" - "{{ extra_pkgs_bpo2 }}"
when: extra_pkgs_bpo | length > 0 or extra_pkgs_bpo1 | length > 0 or extra_pkgs_bpo2 | length > 0 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 - name: Timestamp successfull run and send up-to-date report
ansible.builtin.shell: ansible.builtin.shell:
cmd: date --iso-8601=seconds >> /var/local/ansible-stamps && /usr/local/sbin/reporter cmd: date --iso-8601=seconds >> /var/local/ansible-stamps && /usr/local/sbin/reporter