pabluskinc.dell_powerconnect_switch
Dell PowerConnect Switch
This role sets up Dell PowerConnect switches using the expect Ansible module.
It will also install the Python expect
package on your local machine.
Requirements
The switches must be set up to allow SSH access.
Role Variables
dell_powerconnect_switch_provider
: This holds the authentication information, similar to theprovider
argument used in thedellos
modules. It should be a dictionary containing:host
: the hostname or IP address of the switch.username
: the SSH username for accessing the switch.auth_pass
: the password for authentication.
dell_powerconnect_switch_config
: A list of configuration lines to apply to the switch. It defaults to an empty list.dell_powerconnect_switch_interface_config
: This contains configurations for switch interfaces. It's a dictionary that matches interface names to their configurations. Each configuration may include:description
: a description for the interface.config
: a list of commands for the interface settings.
Dependencies
None
Example Playbook
The following playbook configures switches in the dell-powerconnect-switches
group. It expects each switch to have variables for host, username, and passwords. It applies a global configuration for LLDP and enables two 10G Ethernet interfaces as switchports.
---
- name: Ensure Dell PowerConnect switches are configured
hosts: dell-powerconnect-switches
gather_facts: no
roles:
- role: dell-powerconnect-switch
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"
Author Information
- Pablo Sanchez (pabluski.sanchez@gmail.com) adapted for pct7048p
- Mark Goddard (mark@stackhpc.com)
Role to configure Dell PowerConnect switches Adapted from Mark Goddard's script stackhpc.dell-powerconnect-switch
ansible-galaxy install pabluskinc.dell_powerconnect_switch