From 0b1714119c019182011d070c6a5dcdf919a7042a Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 14 Nov 2016 21:49:38 +0100 Subject: [PATCH] hot-fixes --- salt-pillar/switches/init.sls | 19 +++++++++++++++++-- salt-pillar/vlans/init.sls | 16 ++++++++++++++++ salt/forwarding/init.sls | 4 ++++ salt/lxc-containers-1/containers.yaml | 2 +- salt/lxc-containers-1/init.sls | 8 ++++---- salt/server1-network.sls | 5 ++++- salt/switches/3com-4200G.expect | 14 ++++++++------ 7 files changed, 54 insertions(+), 14 deletions(-) diff --git a/salt-pillar/switches/init.sls b/salt-pillar/switches/init.sls index 333de86..3fd499f 100644 --- a/salt-pillar/switches/init.sls +++ b/salt-pillar/switches/init.sls @@ -33,6 +33,22 @@ switches: vlans: - mgmt - pub + - up1 + server1: + mode: trunk + ports: + - '37' + - '38' + - '39' + - '40' + vlans: + - mgmt + - pub + - core + - up1 + - priv1 + - priv2 + - serv mgmt: mode: access ports: @@ -43,8 +59,6 @@ switches: - '2' - '3' - '24' - - '37' - - '48' switch-b2: model: '3com-4200G' location: Haus B Souterrain @@ -81,6 +95,7 @@ switches: vlans: - mgmt - pub + - up1 up1: mode: access ports: diff --git a/salt-pillar/vlans/init.sls b/salt-pillar/vlans/init.sls index 6f3698a..de8ffe3 100644 --- a/salt-pillar/vlans/init.sls +++ b/salt-pillar/vlans/init.sls @@ -7,3 +7,19 @@ vlans: up2: 11 up3: 12 up4: 13 + priv1: 40 + priv2: 41 + priv3: 42 + priv4: 43 + priv5: 44 + priv6: 45 + priv7: 46 + priv8: 47 + priv9: 48 + priv10: 49 + priv11: 50 + priv12: 51 + priv13: 52 + priv14: 53 + priv15: 54 + priv16: 55 diff --git a/salt/forwarding/init.sls b/salt/forwarding/init.sls index 080c6ce..ed4e707 100644 --- a/salt/forwarding/init.sls +++ b/salt/forwarding/init.sls @@ -1,3 +1,6 @@ +procps: + pkg.installed: [] + /etc/sysctl.d/80-forwarding.conf: file.managed: - source: "salt://forwarding/forwarding.conf" @@ -7,3 +10,4 @@ apply: - name: sysctl -p /etc/sysctl.d/80-forwarding.conf require: - file: /etc/sysctl.d/80-forwarding.conf + - pkg: procps diff --git a/salt/lxc-containers-1/containers.yaml b/salt/lxc-containers-1/containers.yaml index 276b6f4..d255e93 100644 --- a/salt/lxc-containers-1/containers.yaml +++ b/salt/lxc-containers-1/containers.yaml @@ -31,7 +31,7 @@ upstream1: core: type: veth up1: - type: veth + type: phys anon1: interfaces: diff --git a/salt/lxc-containers-1/init.sls b/salt/lxc-containers-1/init.sls index fe44092..99f1a70 100644 --- a/salt/lxc-containers-1/init.sls +++ b/salt/lxc-containers-1/init.sls @@ -19,8 +19,8 @@ lxc: - context: id: {{ id }} container: {{ container }} - - require_in: - cmd: /var/lib/lxc/{{ id }} + - require: + - cmd: /var/lib/lxc/{{ id }} /var/lib/lxc/{{ id }}/rootfs/etc/hosts: file.managed: @@ -29,8 +29,8 @@ lxc: - context: id: {{ id }} container: {{ container }} - - require_in: - cmd: /var/lib/lxc/{{ id }} + - require: + - cmd: /var/lib/lxc/{{ id }} autostart-{{ id }}: service.enabled: diff --git a/salt/server1-network.sls b/salt/server1-network.sls index 0c6c2e3..506705c 100644 --- a/salt/server1-network.sls +++ b/salt/server1-network.sls @@ -29,7 +29,7 @@ bond0.{{ vlan }}: - network: bond0 {% endfor %} -{%- for net in ['core', 'serv'] %} +{%- for net in ['core', 'serv', 'mgmt'] %} {%- set vlan = pillar['vlans'][net] %} br-{{ net }}: network.managed: @@ -41,6 +41,9 @@ br-{{ net }}: proto: static address: {{ ip_addr }} netmask: {{ netmasks[prefix_len] }} +{%- if net == 'core' %} + gateway: {{ pillar['hosts-inet']['core']['upstream1'] }} +{%- endif %} {%- else %} proto: manual {%- endif %} diff --git a/salt/switches/3com-4200G.expect b/salt/switches/3com-4200G.expect index 7eb09b9..5fa0966 100644 --- a/salt/switches/3com-4200G.expect +++ b/salt/switches/3com-4200G.expect @@ -31,7 +31,7 @@ send "quit\r" expect "{{ hostname }}]" {%- for name, vlan in pillar['vlans'].items() %} - +{%- if name == 'mgmt' %} send "vlan {{ vlan }}\r" expect -- "-vlan{{ vlan }}]" send "description {{ name }}\r" @@ -44,15 +44,15 @@ send "interface Vlan-interface {{ vlan }}\r" expect "]" send "description {{ name }}\r" expect "]" -{%- set net_hosts = pillar['hosts-inet'].get(name) %} -{%- set ipaddr = net_hosts and net_hosts.get(hostname) %} -{%- if ipaddr %} +{%- set net_hosts = pillar['hosts-inet'].get(name) %} +{%- set ipaddr = net_hosts and net_hosts.get(hostname) %} +{%- if ipaddr %} send "ip address {{ ipaddr }} {{ netmasks[pillar['subnets-inet'][name].split('/')[1]] }}\r" expect "]" -{%- endif %} +{%- endif %} send "quit\r" expect "{{ hostname }}]" - +{%- endif %} {%- endfor %} {%- set group = 0 %} @@ -64,6 +64,8 @@ send "interface gigabitEthernet 1/0/{{ port }}\r" expect "]" send "lacp enable\r" expect "]" +send "undo port link-aggregation group\r" +expect "]" send "port link-aggregation group {{ group }}\r" expect "]" send "port link-type trunk\r"