45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
---
|
|
# Set the boot mode (BIOS, UEFI) of Dell compute nodes.
|
|
|
|
- name: Ensure compute nodes are present in the Ansible inventory
|
|
hosts: config-mgmt
|
|
gather_facts: no
|
|
vars:
|
|
# Set this to a colon-separated list of compute node hostnames on which to
|
|
# set the boot mode. If unset, all compute nodes will be set.
|
|
compute_node_limit: ""
|
|
compute_node_limit_list: "{{ compute_node_limit.split(':') }}"
|
|
tasks:
|
|
- name: Add hosts for the compute nodes
|
|
add_host:
|
|
name: "{{ item.key }}"
|
|
groups: compute
|
|
with_dict: "{{ idrac_network_ips }}"
|
|
# Don't add hosts that already exist.
|
|
when:
|
|
- "{{ item.key not in groups['all'] }}"
|
|
- "{{ item.key | replace('-idrac', '') not in groups['all'] }}"
|
|
- "{{ not compute_node_limit or item.key | replace('-idrac', '') in compute_node_limit_list }}"
|
|
run_once: True
|
|
|
|
- name: Ensure compute nodes boot mode is set
|
|
hosts: compute
|
|
gather_facts: no
|
|
vars:
|
|
# Set this to the required boot mode. One of 'bios' or 'uefi'.
|
|
drac_boot_mode: "bios"
|
|
tasks:
|
|
- name: Set a fact containing the compute node IPMI address
|
|
set_fact:
|
|
ansible_host: "{{ idrac_network_ips[inventory_hostname] }}"
|
|
ansible_user: "{{ ipmi_username }}"
|
|
ansible_ssh_pass: "{{ ipmi_password }}"
|
|
|
|
- name: Ensure the compute node's BMC is added as an SSH known host
|
|
include_role:
|
|
role: ssh-known-host
|
|
|
|
- name: Ensure the compute node's boot mode is set
|
|
include_role:
|
|
role: drac-boot-mode
|