forked from openstack/kayobe
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from stackhpc/artemis/2023.1
2023.1: Backport Cumulus NVUE support
- Loading branch information
Showing
8 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
NVUE Switch | ||
=========== | ||
|
||
This role configures Cumulus switches using the `nvidia.nvue.command` Ansible | ||
module. It provides a fairly minimal abstraction of the configuration interface | ||
provided by the `nvidia.nvue.command` module, allowing for application of | ||
arbitrary switch configuration options. | ||
|
||
Requirements | ||
------------ | ||
|
||
The switches should be configured to allow SSH access. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
`nvue_switch_config` is a list of NVUE commands to apply to the switch, and | ||
defaults to an empty list. Commands must be formatted without the `nv` prefix, | ||
which is added by the `nvidia.nvue.command` module before execution on the | ||
switch. | ||
|
||
`nvue_switch_interface_config` contains interface configuration. It is a dict | ||
mapping switch interface names to configuration dicts. Interfaces can be switch | ||
physical interfaces, but also special interfaces such as bridges or bonds. Each | ||
dict may contain the following items: | ||
|
||
- `description` - a description to apply to the interface. | ||
- `config` - a list of per-interface configuration, each applied with a `nv | ||
set interface <interface-name>` prefix. | ||
|
||
Dependencies | ||
------------ | ||
|
||
None | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
The following playbook configures hosts in the `nvue-switches` group. It | ||
applies global configuration to configure a BGP AS and add two EBGP neighbors | ||
using BGP Unnumbered, enables two host interfaces with jumbo frames, and | ||
attaches them to a traditional bridge called `bridge1` configured with an IP | ||
address. | ||
|
||
--- | ||
- name: Ensure Cumulus switches are configured with NVUE | ||
hosts: nvue-switches | ||
gather_facts: no | ||
roles: | ||
- role: nvue-switch | ||
nvue_switch_config: | ||
- "set router bgp autonomous-system 65000" | ||
- "set router bgp neighbor swp51 interface remote-as external" | ||
- "set router bgp neighbor swp52 interface remote-as external" | ||
nvue_switch_interface_config: | ||
swp1: | ||
description: server1 | ||
config: | ||
- "link mtu 9000" | ||
swp2: | ||
description: server2 | ||
config: | ||
- "link mtu 9000" | ||
bridge1: | ||
config: | ||
- "ip address 10.100.100.1/24" | ||
- "ports swp1" | ||
- "ports swp2" | ||
|
||
Author Information | ||
------------------ | ||
|
||
- Michal Nasiadka (<[email protected]>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
# List of configuration lines to apply to the switch. | ||
nvue_switch_config: [] | ||
|
||
# Interface configuration. Dict mapping switch interface names to configuration | ||
# dicts. Each dict contains a 'description' item and a 'config' item which | ||
# should contain a list of per-interface configuration. | ||
nvue_switch_interface_config: {} | ||
|
||
# Whether to save the NVUE configuration to disk. | ||
nvue_switch_save: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Ensure Cumulus switches are configured with NVUE | ||
nvidia.nvue.command: | ||
assume_yes: true | ||
atomic: true | ||
save: "{{ nvue_switch_save | bool }}" | ||
template: "{{ lookup('template', 'nvue-config.j2') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#jinja2: trim_blocks: True,lstrip_blocks: True | ||
{% for line in nvue_switch_config %} | ||
{{ line }} | ||
{% endfor %} | ||
{% for interface, config in nvue_switch_interface_config.items() %} | ||
{% for line in config.config %} | ||
set interface {{ interface }} {{ line }} | ||
{% endfor %} | ||
{% if config.description is defined %} | ||
set interface {{ interface }} description {{ config.description }} | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
features: | ||
- | | ||
Adds support for configuring Cumulus switches using the `NVIDIA User | ||
Experience command line utility (NVUE) | ||
<https://docs.nvidia.com/networking-ethernet-software/cumulus-linux/System-Configuration/NVIDIA-User-Experience-NVUE/>`__. | ||
This is integrated with the ``kayobe physical network configure`` command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters