Add a --display argument to kayobe physical network configure
This will output the candidate configuration, without applying it.
This commit is contained in:
parent
4f1ba98167
commit
13a14664f9
@ -16,6 +16,9 @@
|
|||||||
# to configure in order to restrict configuration to a subset of
|
# to configure in order to restrict configuration to a subset of
|
||||||
# interfaces.
|
# interfaces.
|
||||||
physical_network_interface_description_limit: ''
|
physical_network_interface_description_limit: ''
|
||||||
|
# Set this variable to True in order to display the candidate switch
|
||||||
|
# configuration and exit without applying it.
|
||||||
|
physical_network_display: False
|
||||||
tasks:
|
tasks:
|
||||||
- name: Fail if both interface name and description limits are specified
|
- name: Fail if both interface name and description limits are specified
|
||||||
fail:
|
fail:
|
||||||
@ -30,6 +33,10 @@
|
|||||||
group_by:
|
group_by:
|
||||||
key: "switches_of_type_{{ switch_type }}"
|
key: "switches_of_type_{{ switch_type }}"
|
||||||
|
|
||||||
|
- name: Group hosts by whether display mode is set
|
||||||
|
group_by:
|
||||||
|
key: "switches_in_display_mode_{{ physical_network_display | bool }}"
|
||||||
|
|
||||||
- name: Add discovery interface configuration when performing discovery
|
- name: Add discovery interface configuration when performing discovery
|
||||||
set_fact:
|
set_fact:
|
||||||
switch_interface_config: >
|
switch_interface_config: >
|
||||||
@ -50,8 +57,20 @@
|
|||||||
switch_interface_config_select_description(physical_network_interface_description_limit.split(",")) }}
|
switch_interface_config_select_description(physical_network_interface_description_limit.split(",")) }}
|
||||||
when: physical_network_interface_description_limit != ''
|
when: physical_network_interface_description_limit != ''
|
||||||
|
|
||||||
|
- name: Display switch configuration
|
||||||
|
hosts: switches_in_display_mode_True
|
||||||
|
gather_facts: no
|
||||||
|
tasks:
|
||||||
|
- name: Display the candidate global switch configuration
|
||||||
|
debug:
|
||||||
|
var: switch_config
|
||||||
|
|
||||||
|
- name: Display the candidate switch interface configuration
|
||||||
|
debug:
|
||||||
|
var: switch_interface_config
|
||||||
|
|
||||||
- name: Ensure DellOS physical switches are configured
|
- name: Ensure DellOS physical switches are configured
|
||||||
hosts: switches_of_type_dellos6:switches_of_type_dellos9
|
hosts: switches_of_type_dellos6:switches_of_type_dellos9:&switches_in_display_mode_False
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
roles:
|
roles:
|
||||||
- role: ssh-known-host
|
- role: ssh-known-host
|
||||||
@ -63,7 +82,7 @@
|
|||||||
dell_switch_interface_config: "{{ switch_interface_config }}"
|
dell_switch_interface_config: "{{ switch_interface_config }}"
|
||||||
|
|
||||||
- name: Ensure Juniper physical switches are configured
|
- name: Ensure Juniper physical switches are configured
|
||||||
hosts: switches_of_type_junos
|
hosts: switches_of_type_junos:&switches_in_display_mode_False
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
roles:
|
roles:
|
||||||
- role: ssh-known-host
|
- role: ssh-known-host
|
||||||
|
@ -50,6 +50,9 @@ The names or descriptions should be separated by commas. This may be useful
|
|||||||
when adding compute nodes to an existing deployment, in order to avoid changing
|
when adding compute nodes to an existing deployment, in order to avoid changing
|
||||||
the configuration interfaces in use by active nodes.
|
the configuration interfaces in use by active nodes.
|
||||||
|
|
||||||
|
The ``display`` argument will display the candidate switch configuration,
|
||||||
|
without actually applying it.
|
||||||
|
|
||||||
Seed Hypervisor
|
Seed Hypervisor
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ Features
|
|||||||
* Adds ``--interface-limit`` and ``--interface-description-limit`` arguments to
|
* Adds ``--interface-limit`` and ``--interface-description-limit`` arguments to
|
||||||
the ``kayobe physical network configure`` command. These arguments allow
|
the ``kayobe physical network configure`` command. These arguments allow
|
||||||
configuration to be limited to a subset of switch interfaces.
|
configuration to be limited to a subset of switch interfaces.
|
||||||
|
* Adds a ``display`` argument to ``kayobe physical network configure`` command.
|
||||||
|
This will output the candidate switch configuration without applying it.
|
||||||
|
|
||||||
Upgrade Notes
|
Upgrade Notes
|
||||||
-------------
|
-------------
|
||||||
|
@ -227,6 +227,9 @@ class PhysicalNetworkConfigure(KayobeAnsibleMixin, VaultMixin, Command):
|
|||||||
group = parser.add_argument_group("Physical Networking")
|
group = parser.add_argument_group("Physical Networking")
|
||||||
group.add_argument("--group", required=True,
|
group.add_argument("--group", required=True,
|
||||||
help="the Ansible group to apply configuration to")
|
help="the Ansible group to apply configuration to")
|
||||||
|
group.add_argument("--display", action="store_true",
|
||||||
|
help="display the candidate configuration and exit "
|
||||||
|
"without applying it")
|
||||||
group.add_argument("--enable-discovery", action="store_true",
|
group.add_argument("--enable-discovery", action="store_true",
|
||||||
help="configure the network for hardware discovery")
|
help="configure the network for hardware discovery")
|
||||||
group.add_argument("--interface-limit",
|
group.add_argument("--interface-limit",
|
||||||
@ -240,6 +243,7 @@ class PhysicalNetworkConfigure(KayobeAnsibleMixin, VaultMixin, Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.app.LOG.debug("Configuring a physical network")
|
self.app.LOG.debug("Configuring a physical network")
|
||||||
extra_vars = {}
|
extra_vars = {}
|
||||||
|
extra_vars["physical_network_display"] = parsed_args.display
|
||||||
if parsed_args.enable_discovery:
|
if parsed_args.enable_discovery:
|
||||||
extra_vars["physical_network_enable_discovery"] = True
|
extra_vars["physical_network_enable_discovery"] = True
|
||||||
if parsed_args.interface_limit:
|
if parsed_args.interface_limit:
|
||||||
|
Loading…
Reference in New Issue
Block a user