diff --git a/.gitignore b/.gitignore index 909a038d3..c8d0fadd8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ ansible/roles/ahuffman.resolv/ ansible/roles/jriguera.configdrive/ ansible/roles/mrlesmithjr.manage-lvm/ ansible/roles/MichaelRigart.interfaces/ +ansible/roles/stackhpc.drac/ +ansible/roles/stackhpc.drac-facts/ ansible/roles/resmo.ntp/ ansible/roles/yatesr.timezone/ diff --git a/ansible/drac-bios.yml b/ansible/drac-bios.yml new file mode 100644 index 000000000..2b767778c --- /dev/null +++ b/ansible/drac-bios.yml @@ -0,0 +1,31 @@ +--- +- name: Ensure that controller BIOS are configured + hosts: controllers + gather_facts: no + vars: + bios_config: + OneTimeBootMode: "OneTimeBootSeq" + OneTimeBootSeqDev: NIC.Integrated.1-1-1 + roles: + - role: stackhpc.drac + drac_address: "{{ ipmi_address }}" + drac_username: "{{ ipmi_username }}" + drac_password: "{{ ipmi_password }}" + drac_bios_config: "{{ bios_config }}" + drac_reboot: True + + tasks: + - name: Ensure BIOS configuration is applied + command: "racadm {{ item }}" + with_items: + - set Nic.NICConfig.1.LegacyBootProto NONE + - jobqueue create NIC.Integrated.1-1-1 -s TIME_NOW + - set Nic.NICConfig.2.LegacyBootProto NONE + - jobqueue create NIC.Integrated.1-2-1 -s TIME_NOW + - set Nic.NICConfig.3.LegacyBootProto PXE + - jobqueue create NIC.Integrated.1-3-1 -s TIME_NOW + - set Nic.NICConfig.4.LegacyBootProto NONE + - jobqueue create NIC.Integrated.1-4-1 -s TIME_NOW + - set BIOS.BiosBootSettings.bootseq NIC.Integrated.1-3-1,HardDisk.List.1-1,Optical.SATAEmbedded.J-1 + - jobqueue create BIOS.Setup.1-1 + - serveraction powercycle diff --git a/ansible/drac-boot-order.yml b/ansible/drac-boot-order.yml new file mode 100644 index 000000000..1977008a2 --- /dev/null +++ b/ansible/drac-boot-order.yml @@ -0,0 +1,27 @@ +--- +- name: Ensure that controller boot order is configured + hosts: controllers + gather_facts: no + vars: + ansible_host: "{{ ipmi_address }}" + ansible_user: "{{ ipmi_username }}" + ansible_ssh_pass: "{{ ipmi_password }}" + drac_pxe_interface: 3 + drac_interfaces: [1, 2, 3, 4] + tasks: + - name: Ensure NIC boot protocol is configured + raw: "racadm set Nic.NICConfig.{{ item }}.LegacyBootProto {% if item == drac_pxe_interface %}PXE{% else %}NONE{% endif %}" + with_items: "{{ drac_interfaces }}" + + - name: Ensure NIC configuration jobs are created + raw: "racadm jobqueue create NIC.Integrated.1-{{ item }}-1 -s TIME_NOW" + with_items: "{{ drac_interfaces }}" + + - name: Ensure BIOS boot sequence is configured + raw: "racadm set BIOS.BiosBootSettings.bootseq NIC.Integrated.1-{{ drac_pxe_interface }}-1,HardDisk.List.1-1,Optical.SATAEmbedded.J-1" + + - name: Ensure BIOS configuration job is created + raw: "racadm jobqueue create BIOS.Setup.1-1" + + - name: Ensure server is rebooted + raw: "racadm serveraction powercycle" diff --git a/ansible/drac-facts.yml b/ansible/drac-facts.yml new file mode 100644 index 000000000..e2bc0e224 --- /dev/null +++ b/ansible/drac-facts.yml @@ -0,0 +1,25 @@ +--- +- name: Ensure that controller BIOS are configured + hosts: controllers + gather_facts: no + roles: + # The role simply pulls in the drac_facts module. + - role: stackhpc.drac-facts + tasks: + - name: Gather facts via DRAC + local_action: + module: drac_facts + address: "{{ ipmi_address }}" + username: "{{ ipmi_username }}" + password: "{{ ipmi_password }}" + register: result + + - name: Display results + debug: + var: result + + - name: Write facts to a file + local_action: + module: copy + content: "{{ result }}" + dest: "/tmp/drac-facts-{{ inventory_hostname }}.json" diff --git a/ansible/requirements.yml b/ansible/requirements.yml index 50b8fff95..a07eb9039 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -4,4 +4,6 @@ - src: MichaelRigart.interfaces - src: mrlesmithjr.manage-lvm - src: resmo.ntp +- src: stackhpc.drac +- src: stackhpc.drac-facts - src: yatesr.timezone