diff --git a/salt-pillar/switches/init.sls b/salt-pillar/switches/init.sls index ccdc50e..333de86 100644 --- a/salt-pillar/switches/init.sls +++ b/salt-pillar/switches/init.sls @@ -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 diff --git a/salt/switches/TL-SG3210.expect b/salt/switches/TL-SG3210.expect index 7fc6fe1..d36fb10 100644 --- a/salt/switches/TL-SG3210.expect +++ b/salt/switches/TL-SG3210.expect @@ -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)#" diff --git a/salt/top.sls b/salt/top.sls index a45238e..b063684 100644 --- a/salt/top.sls +++ b/salt/top.sls @@ -4,6 +4,7 @@ base: - server1-network - lxc-containers-1 - ospf + - switches '*-gw': - no-ssh - forwarding