Initial project commit

This commit is contained in:
2024-12-16 19:59:57 -05:00
commit fa1b5cce00
3409 changed files with 460909 additions and 0 deletions

View File

@ -0,0 +1,47 @@
---
- name: Max check count reached
ansible.builtin.fail:
msg: "Max check count ({{ verified_reboot_max_checks }}) reached. Aborting after {{ verified_reboot_check_count }} tries."
when:
- verified_reboot_check_count | int >= verified_reboot_max_checks
- name: Increment check count
ansible.builtin.set_fact:
verified_reboot_check_count: "{{ verified_reboot_check_count | int + 1 }}"
- name: Current Iteration
ansible.builtin.debug:
msg: "{{ verified_reboot_check_count }}"
verbosity: 1
- name: Wait for host to connect or try again
block:
- name: Wait for connection to host
ansible.builtin.wait_for_connection:
connect_timeout: "{{ verified_reboot_wait_conn_timeout }}"
sleep: "{{ verified_reboot_wait_sleep }}"
delay: "{{ verified_reboot_wait_delay }}"
timeout: "{{ verified_reboot_wait_timeout }}"
rescue:
- name: Re-check host status - RESCUE
ansible.builtin.include_tasks: check_boot_id.yml
- name: Capture boot ID post reboot
ansible.builtin.slurp:
src: "{{ verified_reboot_bootid_file }}"
register: verified_reboot_post_boot_id_raw
- name: Set post-reboot boot ID
ansible.builtin.set_fact:
verified_reboot_post_boot_id: "{{ verified_reboot_post_boot_id_raw['content'] | b64decode | trim }}"
- name: Debug boot IDs
ansible.builtin.debug:
msg: "{{ verified_reboot_pre_boot_id }} == {{ verified_reboot_post_boot_id }}"
verbosity: 1
- name: Re-check host status
ansible.builtin.include_tasks: check_boot_id.yml
when:
- verified_reboot_pre_boot_id == verified_reboot_post_boot_id
- verified_reboot_check_count | int < verified_reboot_max_checks

View File

@ -0,0 +1,17 @@
---
- name: Capture initial boot ID
ansible.builtin.slurp:
src: "{{ verified_reboot_bootid_file }}"
register: verified_reboot_pre_boot_id_raw
- name: Set pre-reboot boot ID
ansible.builtin.set_fact:
verified_reboot_pre_boot_id: "{{ verified_reboot_pre_boot_id_raw['content'] | b64decode | trim }}"
verified_reboot_check_count: 0
- name: Reboot the host
ansible.builtin.command:
cmd: "/usr/sbin/shutdown -r +{{ verified_reboot_reboot_time }} '{{ verified_reboot_reboot_msg }}'"
- name: Verify reboot status of host
ansible.builtin.include_tasks: check_boot_id.yml