From 35259800aa1901ad660fc5eb7acf88b19c131919 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 25 Oct 2022 14:29:50 +0100 Subject: [PATCH] switches: add flag to save configuration on Dell switches Currently only supported on Dell OS9 and OS10 switches, and provides no CLI integration. Change-Id: Ia9242ed823868cba3a27fb9344a3b01283528d87 --- ansible/inventory/group_vars/switches | 3 +++ ansible/physical-network.yml | 1 + ansible/roles/dell-switch/defaults/main.yml | 3 +++ ansible/roles/dell-switch/tasks/main.yml | 3 +++ doc/source/configuration/reference/physical-network.rst | 3 +++ releasenotes/notes/dell-switch-save-0d49488a5c4c25c0.yaml | 6 ++++++ 6 files changed, 19 insertions(+) create mode 100644 ansible/inventory/group_vars/switches create mode 100644 releasenotes/notes/dell-switch-save-0d49488a5c4c25c0.yaml diff --git a/ansible/inventory/group_vars/switches b/ansible/inventory/group_vars/switches new file mode 100644 index 000000000..85ff4e7c9 --- /dev/null +++ b/ansible/inventory/group_vars/switches @@ -0,0 +1,3 @@ +--- +# Whether to save switch configuration after it has been applied. +switch_config_save: false diff --git a/ansible/physical-network.yml b/ansible/physical-network.yml index 06a4a4ef0..1be7bbb3c 100644 --- a/ansible/physical-network.yml +++ b/ansible/physical-network.yml @@ -122,6 +122,7 @@ dell_switch_provider: "{{ switch_dellos_provider }}" dell_switch_config: "{{ switch_config }}" dell_switch_interface_config: "{{ switch_interface_config }}" + dell_switch_save: "{{ switch_config_save }}" - name: Ensure Dell PowerConnect physical switches are configured hosts: switches_of_type_dell-powerconnect:&switches_in_display_mode_False diff --git a/ansible/roles/dell-switch/defaults/main.yml b/ansible/roles/dell-switch/defaults/main.yml index f642dd325..36118c251 100644 --- a/ansible/roles/dell-switch/defaults/main.yml +++ b/ansible/roles/dell-switch/defaults/main.yml @@ -12,3 +12,6 @@ dell_switch_config: [] # dicts. Each dict contains a 'description' item and a 'config' item which # should contain a list of per-interface configuration. dell_switch_interface_config: {} + +# Whether to save the configuration. +dell_switch_save: false diff --git a/ansible/roles/dell-switch/tasks/main.yml b/ansible/roles/dell-switch/tasks/main.yml index 07fd3d923..9bc146b89 100644 --- a/ansible/roles/dell-switch/tasks/main.yml +++ b/ansible/roles/dell-switch/tasks/main.yml @@ -4,6 +4,7 @@ module: dellos6_config provider: "{{ dell_switch_provider }}" src: dellos6-config.j2 + save: "{{ dell_switch_save | bool }}" when: dell_switch_type == 'dellos6' - name: Ensure DellOS9 switches are configured @@ -11,6 +12,7 @@ module: dellos9_config provider: "{{ dell_switch_provider }}" src: dellos9-config.j2 + save: "{{ dell_switch_save | bool }}" when: dell_switch_type == 'dellos9' - name: Ensure DellOS10 switches are configured @@ -18,4 +20,5 @@ module: dellos10_config provider: "{{ dell_switch_provider }}" src: "{{ lookup('template', 'dellos10-config.j2') }}" + save: "{{ dell_switch_save | bool }}" when: dell_switch_type == 'dellos10' diff --git a/doc/source/configuration/reference/physical-network.rst b/doc/source/configuration/reference/physical-network.rst index ef5de6f14..6ee5cb8ec 100644 --- a/doc/source/configuration/reference/physical-network.rst +++ b/doc/source/configuration/reference/physical-network.rst @@ -229,6 +229,9 @@ Configuration for these devices is applied using the ``dellos6_config``, ``switch_type`` should be set to ``dellos6``, ``dellos9``, or ``dellos10``. +``switch_config_save`` may be set to ``true`` to enable saving configuration +after it has been applied. + Provider ^^^^^^^^ diff --git a/releasenotes/notes/dell-switch-save-0d49488a5c4c25c0.yaml b/releasenotes/notes/dell-switch-save-0d49488a5c4c25c0.yaml new file mode 100644 index 000000000..ef4812c68 --- /dev/null +++ b/releasenotes/notes/dell-switch-save-0d49488a5c4c25c0.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Adds support for saving configuration to switches when running ``kayobe + physical network configure``. Currently only supported on Dell OS9 and OS10 + devices.