stackhpc.ansible-role-dell-powerconnect-switch
Dell PowerConnect Switch
This role sets up Dell PowerConnect switches using the expect Ansible module.
This role will install the Python expect
package on your local machine.
Requirements
The switches must allow SSH access.
Role Variables
dell_powerconnect_switch_provider
: Information for authentication, similar to theprovider
in thedellos
modules. This should be a dictionary containing:host
: The host or IP address of the switch.username
: The SSH username to access the switch.auth_pass
: The password for authentication.
dell_powerconnect_switch_config
: A list of configuration commands for the switch, defaulting to an empty list.dell_powerconnect_switch_interface_config
: Contains configurations for switch interfaces. It maps interface names to their configurations. Each configuration can include:description
: A description for the interface.name
: A name for the VLAN interface, if applicable.config
: A list of settings for that interface.
dell_powerconnect_switch_write_memory
: A flag that, when true, saves the current configuration to the startup configuration file after applying changes. This keeps the configuration after a restart or power loss. By default, it is set to false.dell_powerconnect_switch_write_command
: The command that runs when thedell_powerconnect_switch_write_memory
flag is true. The default command is "write memory".
Dependencies
None
Example Playbook
The following playbook configures hosts in the dell-powerconnect-switches
group. It assumes that host variables for each switch include the host, username, and passwords. It sets global configurations for LLDP, enables two 10G Ethernet interfaces as switchports, and saves the 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.ansible-role-dell-powerconnect-switch