iDRAC bootstrap - allow port descriptions to be empty, make control host configurable

This commit is contained in:
Mark Goddard 2017-04-05 15:50:47 +01:00
parent 3fd26401e0
commit 50ae62d564
3 changed files with 14 additions and 8 deletions

View File

@ -30,6 +30,9 @@ idrac_bootstrap_vlan:
# Name of network namespace on controller to use for bootstrapping iDRACs. # Name of network namespace on controller to use for bootstrapping iDRACs.
idrac_bootstrap_net_namespace: idrac-bootstrap idrac_bootstrap_net_namespace: idrac-bootstrap
# Controller group to use for bootstrapping iDRACs.
idrac_bootstrap_controller_group:
# Base network interface on controller to use for bootstrapping iDRACs. # Base network interface on controller to use for bootstrapping iDRACs.
idrac_bootstrap_controller_interface: idrac_bootstrap_controller_interface:

View File

@ -32,7 +32,7 @@
# 1. Create a VLAN interface on the controller node with IP in the iDRAC # 1. Create a VLAN interface on the controller node with IP in the iDRAC
# default subnet. # default subnet.
- name: Ensure the controller bootstrap network is configured - name: Ensure the controller bootstrap network is configured
hosts: controllers[0] hosts: "{{ idrac_bootstrap_controller_group ~ '[0]' }}"
tasks: tasks:
# Install Dell server admin tools. # Install Dell server admin tools.
- block: - block:
@ -100,8 +100,8 @@
{{ switch_interface_config_bootstrap | combine({item.key: switch_interface_config_bootstrap_trunk}) }} {{ switch_interface_config_bootstrap | combine({item.key: switch_interface_config_bootstrap_trunk}) }}
with_dict: "{{ switch_interface_config }}" with_dict: "{{ switch_interface_config }}"
when: > when: >
{{ item.value.description == groups['controllers'][0] or {{ item.value.description | default == groups[idrac_bootstrap_controller_group][0] or
item.value.description | replace('-trunk', '') in groups[idrac_bootstrap_switch_group] }} item.value.description | default | replace('-trunk', '') in groups[idrac_bootstrap_switch_group] }}
roles: roles:
# Configure bootstrap VLAN on the switch and add controller and trunk # Configure bootstrap VLAN on the switch and add controller and trunk
@ -140,9 +140,9 @@
switch_interface_name: "{{ item.key }}" switch_interface_name: "{{ item.key }}"
idrac_port_description: "{{ item.value.description }}" idrac_port_description: "{{ item.value.description }}"
idrac_network_ip: "{{ idrac_network_ips[idrac_port_description] }}" idrac_network_ip: "{{ idrac_network_ips[idrac_port_description] }}"
idrac_bootstrap_controller: "{{ hostvars[groups['controllers'][0]].ansible_host }}" idrac_bootstrap_controller: "{{ hostvars[groups[idrac_bootstrap_controller_group][0]].ansible_host }}"
with_dict: "{{ switch_interface_config }}" with_dict: "{{ switch_interface_config }}"
when: "{{ item.value.description in idrac_network_ips }}" when: "{{ item.value.description | default in idrac_network_ips }}"
# 4. Remove the temporary bootstrap VLAN from the switch. # 4. Remove the temporary bootstrap VLAN from the switch.
- name: Ensure the bootstrap VLAN is removed from switches - name: Ensure the bootstrap VLAN is removed from switches
@ -161,8 +161,8 @@
{{ switch_interface_config_bootstrap | combine({item.key: switch_interface_config_bootstrap_trunk}) }} {{ switch_interface_config_bootstrap | combine({item.key: switch_interface_config_bootstrap_trunk}) }}
with_dict: "{{ switch_interface_config }}" with_dict: "{{ switch_interface_config }}"
when: > when: >
{{ item.value.description == groups['controllers'][0] or {{ item.value.description | default == groups[idrac_bootstrap_controller_group][0] or
item.value.description | replace('-trunk', '') in groups[idrac_bootstrap_switch_group] }} item.value.description | default | replace('-trunk', '') in groups[idrac_bootstrap_switch_group] }}
roles: roles:
# Remove bootstrap VLAN from the switch and remove controller and trunk # Remove bootstrap VLAN from the switch and remove controller and trunk
# interfaces from it. # interfaces from it.
@ -177,7 +177,7 @@
# 5. Remove the VLAN interface on the controller node. # 5. Remove the VLAN interface on the controller node.
- name: Ensure the controller bootstrap network is cleaned up - name: Ensure the controller bootstrap network is cleaned up
hosts: controllers[0] hosts: "{{ idrac_bootstrap_controller_group ~ '[0]' }}"
tasks: tasks:
# This should also delete the network interface within the namespace. # This should also delete the network interface within the namespace.
- name: Ensure the bootstrap network namespace is removed from the controller - name: Ensure the bootstrap network namespace is removed from the controller

View File

@ -30,6 +30,9 @@
# Name of network namespace on controller to use for bootstrapping iDRACs. # Name of network namespace on controller to use for bootstrapping iDRACs.
#idrac_bootstrap_net_namespace: #idrac_bootstrap_net_namespace:
# Controller group to use for bootstrapping iDRACs.
#idrac_bootstrap_controller_group:
# Base network interface on controller to use for bootstrapping iDRACs. # Base network interface on controller to use for bootstrapping iDRACs.
#idrac_bootstrap_controller_interface: #idrac_bootstrap_controller_interface: