moar switches configuration

legacy
Astro 6 years ago
parent efb9ec2f80
commit 4d97712d6e

@ -6,45 +6,71 @@ switches:
switch-b2:
mode: trunk
ports:
- 25
- 26
- 27
- 28
- '25'
- '26'
- '27'
- '28'
vlans:
- mgmt
- pub
switch-c1:
mode: trunk
ports:
- 29
- 30
- 31
- 32
- '29'
- '30'
- '31'
- '32'
vlans:
- mgmt
- pub
switch-d1:
mode: trunk
ports:
- 33
- 34
- 35
- 36
- '33'
- '34'
- '35'
- '36'
vlans:
- mgmt
- pub
mgmt:
mode: access
ports:
- 1
- '1'
pub:
mode: access
ports:
- 2
- 3
- 24
- 37
- 48
- '2'
- '3'
- '24'
- '37'
- '48'
switch-b2:
model: '3com-4200G'
location: Haus B Souterrain
ports:
switch-b2:
mode: trunk
ports:
- '25'
- '26'
- '27'
- '28'
vlans:
- mgmt
- pub
mgmt:
mode: access
ports:
- '1'
pub:
mode: access
ports:
- '2'
- '3'
- '24'
- '37'
- '48'
switch-d1:
model: 'TL-SG3210'
location: Turm D Keller
@ -57,10 +83,32 @@ switches:
- pub
up1:
mode: access
ports: 5
ports:
- '5'
mgmt:
mode: access
ports: 6
ports:
- '6'
pub:
mode: access
ports: 7-8
ports:
- 7-8
switch-c1:
model: 'TL-SG3210'
location: Turm D Keller
ports:
switch-b1:
mode: trunk
ports: 1-4
vlans:
- mgmt
- pub
mgmt:
mode: access
ports:
- '6'
pub:
mode: access
ports:
- '5'
- 7-8

@ -8,6 +8,8 @@ spawn telnet {{ pillar['hosts-inet']['mgmt'][hostname] }}
expect "Password:"
send "secret\r"
expect ">"
send "\r"
expect ">"
send "enable\r"
expect "Password:"
send "secret\r"
@ -86,12 +88,14 @@ expect "(config-if-range)#"
send "switchport trunk allowed vlan {{ ','.join(vlan_ids) }}\r"
expect "(config-if-range)#"
{%- elif conf['mode'] == 'access' %}
send "interface range gigabitEthernet 1/0/{{ conf['ports'] }}\r"
{%- for port in conf['ports'] %}
send "interface range gigabitEthernet 1/0/{{ port }}\r"
expect "(config-if-range)#"
send "switchport mode access\r"
expect "(config-if-range)#"
send "switchport access vlan {{ pillar['vlans'][name] }}\r"
expect "(config-if-range)#"
{%- endfor %}
{%- endif %}
send "exit\r"
expect "(config)#"

@ -4,6 +4,7 @@ base:
- server1-network
- lxc-containers-1
- ospf
- switches
'*-gw':
- no-ssh
- forwarding

Loading…
Cancel
Save