Skip to content

Commit

Permalink
fix(osflush): Added tasks to setup.yml to flush OS image and reboot s…
Browse files Browse the repository at this point in the history
…ystems to PXE boot
  • Loading branch information
Sakethanne committed Sep 11, 2024
1 parent 24f3b59 commit 4fcd913
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions ansible/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,50 @@
- name: Set the system time
ansible.builtin.command: "date -s '{{ now() }}'"
changed_when: false

# TODO: Consider automating the OS image flushing process for Host x86 servers (currently done manually).
- name: Flush OS image and reboot systems to PXE boot (iDRAC and iLO)
hosts: hostservers
become: true
tasks:
- name: Set boot to PXE for Dell systems (iDRAC)
when:
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer == "Dell Inc."
community.general.redfish_command:
category: Systems
command: SetOneTimeBoot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
bootdevice: "PXE"

- name: Set boot to PXE for HP systems (iLO)
when:
- inventory_hostname == 'dh2bmc' or inventory_hostname == 'dh3bmc'
community.general.redfish_command:
category: Systems
command: SetOneTimeBoot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
bootdevice: "PXE"

- name: Reboot systems to initiate PXE boot for OS flush
community.general.redfish_command:
category: Systems
command: PowerReboot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"

- name: Wait for the system to come back online
ansible.builtin.wait_for_connection:
delay: 60
timeout: 600

- name: Intel MEV | Enable Proxy and Port Forwarding
hosts: mevbmc
Expand Down

0 comments on commit 4fcd913

Please sign in to comment.