stackhpc.dell-powerconnect-switch
Dell PowerConnect Switch
This role helps set up Dell PowerConnect switches using the expect Ansible module.
It will also install the Python expect
package on the local machine.
Requirements
Make sure the switches can be accessed via SSH.
Role Variables
dell_powerconnect_switch_provider
contains the authentication details for the switch, similar to what you'd use in the provider
argument for the dellos
modules. It should include:
host
: the server or IP address of the switch.username
: the SSH username for the switch.auth_pass
: the password for authentication.
dell_powerconnect_switch_config
is a list of configuration commands to apply to the switch, which is empty by default.
dell_powerconnect_switch_interface_config
holds configurations for specific interfaces. It maps switch interface names to their configuration information. Each configuration can include:
description
: a description for the interface.name
: the name for the VLAN interface, if you're setting up a VLAN.config
: a list of commands for that specific interface.
dell_powerconnect_switch_write_memory
is a flag that, when true, will save the current configuration to the startup file. This ensures the settings remain after a restart or power loss. By default, this is set to false.
dell_powerconnect_switch_write_command
is the command used when dell_powerconnect_switch_write_memory
is true. The default command is "write memory".
Dependencies
None
Example Playbook
This playbook sets up hosts in the dell-powerconnect-switches
group. It assumes each switch has variables for hostnames, usernames, and passwords. It applies a global configuration for LLDP, enables two 10G Ethernet interfaces for switching, and saves the configuration changes.
---
- name: Ensure Dell PowerConnect switches are configured
hosts: dell-powerconnect-switches
gather_facts: no
roles:
- role: dell-powerconnect-switch
dell_powerconnect_switch_write_memory: yes
dell_powerconnect_switch_provider:
host: "{{ switch_host }}"
username: "{{ switch_user }}"
password: "{{ switch_password }}"
transport: cli
authorize: yes
auth_pass: "{{ switch_auth_pass }}"
dell_powerconnect_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_powerconnect_switch_interface_config:
Te1/1/1:
description: server-1
config:
- "no shutdown"
- "switchport"
Te1/1/2:
description: server-2
config:
- "no shutdown"
- "switchport"
"vlan 1234":
name: "mytestvlan"
config:
- "ip address 192.168.1.254 255.255.255.0"
Author Information
- Mark Goddard (mark@stackhpc.com)
Role to configure Dell PowerConnect switches
ansible-galaxy install stackhpc.dell-powerconnect-switch