kayobe/ansible/roles/dell-switch
Mark Goddard 67f09241e0 Fix Dell OS6 and Dell OS9 switch configuration
Previously the dellos6_config and dellos9_config modules accepted the
name of a template file as their 'src' parameter, or a string containing
the actual config. Now they only accept the config string. Kayobe passes
the name of a template file, resulting in a strange error from the
switch about an invalid command dellos6-config.j2 or dellos9-config.j2.

This change fixes the issue in the same way it was fixed for Dell OS10
switches, by using the template lookup plugin to evaluate the config
file template.

Change-Id: Ic14e2b75c785b4db03b5e659e5a2be2ee83eace3
Closes-Bug: #2061102
2024-04-12 10:17:21 +01:00
..
defaults switches: add flag to save configuration on Dell switches 2023-11-01 16:57:03 +00:00
tasks Fix Dell OS6 and Dell OS9 switch configuration 2024-04-12 10:17:21 +01:00
templates Add support for dellos10 switch configuration 2022-06-09 21:59:33 +02:00
README.md Add support for dellos10 switch configuration 2022-06-09 21:59:33 +02:00

Dell Switch

This role configures Dell switches using the dellos6, dellos9, or dellos10 Ansible modules. It provides a fairly minimal abstraction of the configuration interface provided by the dellos modules, allowing for application of arbitrary switch configuration options.

Requirements

The switches should be configured to allow SSH access.

Role Variables

dell_switch_type is the type of Dell switch. One of dellos6, dellos9, or dellos10.

dell_switch_provider is authentication provider information passed as the provider argument to the dellos modules.

dell_switch_config is a list of configuration lines to apply to the switch, and defaults to an empty list.

dell_switch_interface_config contains interface configuration. It is a dict mapping switch interface names to configuration dicts. Each dict may contain the following items:

  • description - a description to apply to the interface.
  • config - a list of per-interface configuration.

Dependencies

None

Example Playbook

The following playbook configures hosts in the dellos9-switches group. It assumes host variables for each switch holding the host, username and passwords. It applies global configuration for LLDP, and enables two 10G ethernet interfaces as switchports.

---
- name: Ensure DellOS switches are configured
  hosts: dellos9-switches
  gather_facts: no
  roles:
    - role: dell-switch
      dell_switch_type: "dellos9"
      dell_switch_provider:
        host: "{{ switch_host }}"
        username: "{{ switch_user }}"
        password: "{{ switch_password }}"
        authorize: yes
        auth_pass: "{{ switch_auth_pass }}"
      dell_switch_config:
        - "protocol lldp"
        - " advertise dot3-tlv max-frame-size"
        - " advertise management-tlv management-address system-description system-name"
        - " advertise interface-port-desc"
        - " no disable"
        - " exit"
      dell_switch_interface_config:
        Te1/1/1:
          description: server-1
          config:
            - "no shutdown"
            - "switchport"
        Te1/1/2:
          description: server-2
          config:
            - "no shutdown"
            - "switchport"

Author Information