quick_test/reboot_test.yml

35 lines
984 B
YAML

---
- name: Something
hosts: bigboot
become: true
gather_facts: false
strategy: free
vars:
bootid_file: /proc/sys/kernel/random/boot_id
max_reboot_check: 10
reboot_check_count: 0
tasks:
- name: Capture initial boot ID
ansible.builtin.slurp:
src: "{{ bootid_file }}"
register: pre_reboot_boot_id_raw
- name: Set pre-reboot boot ID
ansible.builtin.set_fact:
pre_reboot_boot_id: "{{ pre_reboot_boot_id_raw['content'] | b64decode | trim }}"
- name: Reboot the host
ansible.builtin.command:
cmd: "/usr/sbin/shutdown -r +1 '*** ANSIBLE INITIATED REBOOT ***'"
# This may be broken at the moment due to the fact we're
# connecting as 'root' - Try with testuser1 + sudo/become
- name: Verify reboot status of host
ansible.builtin.include_tasks: tasks/check_boot_id.yml
- name: Post reboot tasks go here
ansible.builtin.debug:
msg: Post reboot tasks go here plskkthx!