Skip to content
Snippets Groups Projects
Commit 3ca08afd authored by Mark Goddard's avatar Mark Goddard
Browse files

Add kayobe CLI command to configure the physical network

Currently this can configure interfaces on DellOS6 switches only but can be
extended to support other makes and models.
parent 4652c297
No related branches found
No related tags found
No related merge requests found
---
# Switch configuration.
###############################################################################
# Authentication configuration.
# For DellOS6 switches, this defines a 'provider' argument to the dellos6_*
# modules.
switch_dellos6_provider:
host: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_ssh_pass }}"
transport: cli
authorize: yes
auth_pass: "{{ switch_auth_pass }}"
---
###############################################################################
# Switch type configuration.
# This configures the type of switch, which is used to determine how the switch
# will be configured.
switch_type:
--- ---
- name: Ensure the power and management network switches are configured # Switch configuration depends on the type of switch, so groups hosts by their
hosts: mgmt-switches # switch type and apply tasks/roles to the relevant groups.
- name: Group hosts by their switch type
hosts: switches
gather_facts: no gather_facts: no
vars:
provider:
host: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_ssh_pass }}"
transport: cli
authorize: yes
auth_pass: "{{ switch_auth_pass }}"
tasks: tasks:
- name: Ensure switch interfaces are configured - name: Group hosts by their switch type
group_by:
key: "switches_of_type_{{ switch_type }}"
- name: Ensure DellOS6 physical network devices are configured
hosts: switches_of_type_dellos6
gather_facts: no
tasks:
- name: Ensure DellOS6 switch interfaces are configured
local_action: local_action:
module: dellos6_config module: dellos6_config
provider: "{{ provider }}" provider: "{{ switch_dellos6_provider }}"
lines: > lines: >
{{ ['description ' ~ item.value.description] + {{ ['description ' ~ item.value.description] +
item.value.config | default([]) }} item.value.config | default([]) }}
......
...@@ -127,6 +127,23 @@ class KollaAnsibleRun(KollaAnsibleMixin, Command): ...@@ -127,6 +127,23 @@ class KollaAnsibleRun(KollaAnsibleMixin, Command):
parsed_args.kolla_inventory_filename) parsed_args.kolla_inventory_filename)
class PhysicalNetworkConfigure(KayobeAnsibleMixin, Command):
"""Configure a set of physical network devices."""
def get_parser(self, prog_name):
parser = super(PhysicalNetworkConfigure, self).get_parser(
prog_name)
group = parser.add_argument_group("Physical Networking")
group.add_argument("--group", required=True,
help="the Ansible group to apply configuration to")
return parser
def take_action(self, parsed_args):
self.app.LOG.debug("Configuring a physical network")
ansible.run_playbook(parsed_args, "ansible/physical-network.yml",
limit=parsed_args.group)
class SeedVMProvision(KollaAnsibleMixin, KayobeAnsibleMixin, Command): class SeedVMProvision(KollaAnsibleMixin, KayobeAnsibleMixin, Command):
"""Provision the seed VM.""" """Provision the seed VM."""
......
...@@ -44,6 +44,7 @@ setup( ...@@ -44,6 +44,7 @@ setup(
'overcloud_inventory_discover = kayobe.cli.commands:OvercloudInventoryDiscover', 'overcloud_inventory_discover = kayobe.cli.commands:OvercloudInventoryDiscover',
'overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy', 'overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy',
'overcloud_provision = kayobe.cli.commands:OvercloudProvision', 'overcloud_provision = kayobe.cli.commands:OvercloudProvision',
'physical_network_configure = kayobe.cli.commands:PhysicalNetworkConfigure',
'playbook_run = kayobe.cli.commands:PlaybookRun', 'playbook_run = kayobe.cli.commands:PlaybookRun',
'seed_container_image_build = kayobe.cli.commands:SeedContainerImageBuild', 'seed_container_image_build = kayobe.cli.commands:SeedContainerImageBuild',
'seed_host_configure = kayobe.cli.commands:SeedHostConfigure', 'seed_host_configure = kayobe.cli.commands:SeedHostConfigure',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment