Giuseppe Lavagetto has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/358027 )

Change subject: role::lvs::balancer: also manage interface tagging
......................................................................


role::lvs::balancer: also manage interface tagging

It was currently in site.pp, with configuration scattered between there
and lvs::configuration and hiera; make all the info come from a source
hash in hiera, called directly from profile::lvs, to reduce the spread
of information.

Change-Id: Ia0211669e8e9ae81b0d09ae22709fd3d0163f870
---
A hieradata/common/lvs/interfaces.yaml
M hieradata/role/codfw/lvs/balancer.yaml
M hieradata/role/eqiad/lvs/balancer.yaml
M hieradata/role/esams/lvs/balancer.yaml
M hieradata/role/ulsfo/lvs/balancer.yaml
M manifests/site.pp
M modules/lvs/manifests/configuration.pp
M modules/profile/manifests/lvs.pp
A modules/profile/manifests/lvs/tagged_interface.pp
9 files changed, 237 insertions(+), 425 deletions(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/common/lvs/interfaces.yaml 
b/hieradata/common/lvs/interfaces.yaml
new file mode 100644
index 0000000..47985d1
--- /dev/null
+++ b/hieradata/common/lvs/interfaces.yaml
@@ -0,0 +1,185 @@
+lvs::interfaces::vlan_data:
+  private1-a-eqiad:
+    id: "1017"
+    netmask: 255.255.252.0
+    iface:
+      'lvs1001': 'eth0:10.64.1.1'
+      'lvs1002': 'eth0:10.64.1.2'
+      'lvs1003': 'eth0:10.64.1.3'
+      'lvs1004': 'eth1:10.64.1.4'
+      'lvs1005': 'eth1:10.64.1.5'
+      'lvs1006': 'eth1:10.64.1.6'
+      'lvs1010': 'eth1:10.64.1.10'
+  private1-b-eqiad:
+    id: "1018"
+    netmask: 255.255.252.0
+    iface:
+       'lvs1001': 'eth1:10.64.17.1'
+       'lvs1002': 'eth1:10.64.17.2'
+       'lvs1003': 'eth1:10.64.17.3'
+       'lvs1004': 'eth0:10.64.17.4'
+       'lvs1005': 'eth0:10.64.17.5'
+       'lvs1006': 'eth0:10.64.17.6'
+       'lvs1007': 'eth2:10.64.17.7'
+       'lvs1008': 'eth2:10.64.17.8'
+       'lvs1009': 'eth2:10.64.17.9'
+       'lvs1010': 'eth2:10.64.17.10'
+  private1-c-eqiad:
+    id: "1019"
+    netmask: 255.255.252.0
+    iface:
+      'lvs1001': 'eth2:10.64.33.1'
+      'lvs1002': 'eth2:10.64.33.2'
+      'lvs1003': 'eth2:10.64.33.3'
+      'lvs1004': 'eth2:10.64.33.4'
+      'lvs1005': 'eth2:10.64.33.5'
+      'lvs1006': 'eth2:10.64.33.6'
+      'lvs1007': 'eth1:10.64.33.7'
+      'lvs1008': 'eth1:10.64.33.8'
+      'lvs1009': 'eth1:10.64.33.9'
+  private1-d-eqiad:
+    id: "1020"
+    netmask: 255.255.252.0
+    iface:
+      'lvs1001': 'eth3:10.64.49.1'
+      'lvs1002': 'eth3:10.64.49.2'
+      'lvs1003': 'eth3:10.64.49.3'
+      'lvs1004': 'eth3:10.64.49.4'
+      'lvs1005': 'eth3:10.64.49.5'
+      'lvs1006': 'eth3:10.64.49.6'
+      'lvs1007': 'eth3:10.64.49.7'
+      'lvs1008': 'eth3:10.64.49.8'
+      'lvs1009': 'eth3:10.64.49.9'
+      'lvs1010': 'eth3:10.64.49.10'
+  public1-a-eqiad:
+    id: "1001"
+    netmask: "255.255.255.192"
+    iface:
+      'lvs1004': 'eth1:208.80.154.58'
+      'lvs1005': 'eth1:208.80.154.59'
+      'lvs1006': 'eth1:208.80.154.60'
+      'lvs1007': 'eth0:208.80.154.43'
+      'lvs1008': 'eth0:208.80.154.44'
+      'lvs1009': 'eth0:208.80.154.45'
+      'lvs1010': 'eth1:208.80.154.46'
+  public1-b-eqiad:
+    id: "1002"
+    netmask: "255.255.255.192"
+    iface:
+      'lvs1001': 'eth1:208.80.154.140'
+      'lvs1002': 'eth1:208.80.154.141'
+      'lvs1003': 'eth1:208.80.154.142'
+      'lvs1007': 'eth2:208.80.154.161'
+      'lvs1008': 'eth2:208.80.154.162'
+      'lvs1009': 'eth2:208.80.154.163'
+      'lvs1010': 'eth2:208.80.154.164'
+  public1-c-eqiad:
+    id: "1003"
+    netmask: "255.255.255.192"
+    iface:
+      'lvs1001': 'eth2:208.80.154.78'
+      'lvs1002': 'eth2:208.80.154.68'
+      'lvs1003': 'eth2:208.80.154.69'
+      'lvs1004': 'eth2:208.80.154.70'
+      'lvs1005': 'eth2:208.80.154.71'
+      'lvs1006': 'eth2:208.80.154.72'
+      'lvs1007': 'eth1:208.80.154.96'
+      'lvs1008': 'eth1:208.80.154.97'
+      'lvs1009': 'eth1:208.80.154.98'
+      'lvs1010': 'eth0:208.80.154.99'
+  public1-d-eqiad:
+    id: "1004"
+    netmask: "255.255.255.224"
+    iface:
+      'lvs1001': 'eth3:208.80.155.100'
+      'lvs1002': 'eth3:208.80.155.101'
+      'lvs1003': 'eth3:208.80.155.102'
+      'lvs1004': 'eth3:208.80.155.103'
+      'lvs1005': 'eth3:208.80.155.104'
+      'lvs1006': 'eth3:208.80.155.105'
+      'lvs1007': 'eth3:208.80.155.111'
+      'lvs1008': 'eth3:208.80.155.112'
+      'lvs1009': 'eth3:208.80.155.113'
+      'lvs1010': 'eth3:208.80.155.114'
+  public1-a-codfw:
+    id: "2001"
+    netmask: '255.255.255.224'
+    iface:
+      'lvs2001': 'eth0:208.80.153.6'
+      'lvs2002': 'eth0:208.80.153.7'
+      'lvs2003': 'eth0:208.80.153.8'
+      'lvs2004': 'eth1:208.80.153.9'
+      'lvs2005': 'eth1:208.80.153.10'
+      'lvs2006': 'eth1:208.80.153.11'
+  public1-b-codfw:
+    id: "2002"
+    netmask: '255.255.255.224'
+    iface:
+      'lvs2001': 'eth1:208.80.153.39'
+      'lvs2002': 'eth1:208.80.153.40'
+      'lvs2003': 'eth1:208.80.153.41'
+      'lvs2004': 'eth0:208.80.153.36'
+      'lvs2005': 'eth0:208.80.153.37'
+      'lvs2006': 'eth0:208.80.153.38'
+  public1-c-codfw:
+    id: "2003"
+    netmask: '255.255.255.224'
+    iface:
+      'lvs2001': 'eth2:208.80.153.68'
+      'lvs2002': 'eth2:208.80.153.69'
+      'lvs2003': 'eth2:208.80.153.70'
+      'lvs2004': 'eth2:208.80.153.71'
+      'lvs2005': 'eth2:208.80.153.72'
+      'lvs2006': 'eth2:208.80.153.73'
+  public1-d-codfw:
+    id: "2004"
+    netmask: '255.255.255.224'
+    iface:
+      'lvs2001': 'eth3:208.80.153.100'
+      'lvs2002': 'eth3:208.80.153.101'
+      'lvs2003': 'eth3:208.80.153.102'
+      'lvs2004': 'eth3:208.80.153.103'
+      'lvs2005': 'eth3:208.80.153.104'
+      'lvs2006': 'eth3:208.80.153.105'
+  private1-a-codfw:
+    id: "2017"
+    netmask: '255.255.252.0'
+    iface:
+      'lvs2004': 'eth1:10.192.1.4'
+      'lvs2005': 'eth1:10.192.1.5'
+      'lvs2006': 'eth1:10.192.1.6'
+  private1-b-codfw:
+    id: "2018"
+    netmask: '255.255.252.0'
+    iface:
+      'lvs2001': 'eth1:10.192.17.1'
+      'lvs2002': 'eth1:10.192.17.2'
+      'lvs2003': 'eth1:10.192.17.3'
+  private1-c-codfw:
+    id: "2019"
+    netmask: '255.255.252.0'
+    iface:
+      'lvs2001': 'eth2:10.192.33.1'
+      'lvs2002': 'eth2:10.192.33.2'
+      'lvs2003': 'eth2:10.192.33.3'
+      'lvs2004': 'eth2:10.192.33.4'
+      'lvs2005': 'eth2:10.192.33.5'
+      'lvs2006': 'eth2:10.192.33.6'
+  private1-d-codfw:
+    id: "2020"
+    netmask: '255.255.252.0'
+    iface:
+      'lvs2001': 'eth3:10.192.49.1'
+      'lvs2002': 'eth3:10.192.49.2'
+      'lvs2003': 'eth3:10.192.49.3'
+      'lvs2004': 'eth3:10.192.49.4'
+      'lvs2005': 'eth3:10.192.49.5'
+      'lvs2006': 'eth3:10.192.49.6'
+  public1-esams:
+    id: "100"
+    netmask: '255.255.255.128'
+    iface:
+      lvs3001: 'eth0:91.198.174.11'
+      lvs3002: 'eth0:91.198.174.12'
+      lvs3003: 'eth0:91.198.174.13'
+      lvs3004: 'eth0:91.198.174.14'
diff --git a/hieradata/role/codfw/lvs/balancer.yaml 
b/hieradata/role/codfw/lvs/balancer.yaml
index 1853616..9aed290 100644
--- a/hieradata/role/codfw/lvs/balancer.yaml
+++ b/hieradata/role/codfw/lvs/balancer.yaml
@@ -2,3 +2,12 @@
   debdeploy-lvs-codfw:
     value: standard
 profile::pybal::config_host: conf2001.codfw.wmnet
+profile::lvs::tagged_subnets:
+  - private1-a-codfw
+  - private1-b-codfw
+  - private1-c-codfw
+  - private1-d-codfw
+  - public1-a-codfw
+  - public1-b-codfw
+  - public1-c-codfw
+  - public1-d-codfw
diff --git a/hieradata/role/eqiad/lvs/balancer.yaml 
b/hieradata/role/eqiad/lvs/balancer.yaml
index 307292d..6d67134 100644
--- a/hieradata/role/eqiad/lvs/balancer.yaml
+++ b/hieradata/role/eqiad/lvs/balancer.yaml
@@ -2,3 +2,12 @@
   debdeploy-lvs-eqiad:
     value: standard
 profile::pybal::config_host: conf2002.codfw.wmnet
+profile::lvs::tagged_subnets:
+  - private1-a-eqiad
+  - private1-b-eqiad
+  - private1-c-eqiad
+  - private1-d-eqiad
+  - public1-a-eqiad
+  - public1-b-eqiad
+  - public1-c-eqiad
+  - public1-d-eqiad
diff --git a/hieradata/role/esams/lvs/balancer.yaml 
b/hieradata/role/esams/lvs/balancer.yaml
index 178d805..579c9ae 100644
--- a/hieradata/role/esams/lvs/balancer.yaml
+++ b/hieradata/role/esams/lvs/balancer.yaml
@@ -2,3 +2,5 @@
   debdeploy-lvs-esams:
     value: standard
 profile::pybal::config_host: conf2002.codfw.wmnet
+profile::lvs::tagged_subnets:
+  - public1-esams
diff --git a/hieradata/role/ulsfo/lvs/balancer.yaml 
b/hieradata/role/ulsfo/lvs/balancer.yaml
index 85770b5..f22b1fe 100644
--- a/hieradata/role/ulsfo/lvs/balancer.yaml
+++ b/hieradata/role/ulsfo/lvs/balancer.yaml
@@ -2,3 +2,4 @@
   debdeploy-lvs-ulsfo:
     value: standard
 profile::pybal::config_host: conf2001.codfw.wmnet
+profile::lvs::tagged_subnets: []
diff --git a/manifests/site.pp b/manifests/site.pp
index 4bd1c79..b755422 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -1447,89 +1447,7 @@
     #   (chromium and hydrogen) with fallback to codfw
     # (doing this for all lvs for now, see T103921)
     $nameservers_override = [ '208.80.154.157', '208.80.154.50', 
'208.80.153.254' ]
-
     role(lvs::balancer)
-
-    interface::add_ip6_mapped { 'main': }
-
-    include ::lvs::configuration
-    $ips = $lvs::configuration::subnet_ips
-
-    # Set up tagged interfaces to all subnets with real servers in them
-    # lint:ignore:case_without_default
-    case $::hostname {
-    # lint:endignore
-        /^lvs100[1-3]$/: {
-            # Row A subnets on eth0
-            interface::tagged { 'eth0.1017':
-                base_interface => 'eth0',
-                vlan_id        => '1017',
-                address        => $ips['private1-a-eqiad'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-            # Row B subnets on eth1
-            interface::tagged { 'eth1.1002':
-                base_interface => 'eth1',
-                vlan_id        => '1002',
-                address        => $ips['public1-b-eqiad'][$::hostname],
-                netmask        => '255.255.255.192',
-            }
-            interface::tagged { 'eth1.1018':
-                base_interface => 'eth1',
-                vlan_id        => '1018',
-                address        => $ips['private1-b-eqiad'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-        }
-        /^lvs100[4-6]$/: {
-            # Row B subnets on eth0
-            interface::tagged { 'eth0.1018':
-                base_interface => 'eth0',
-                vlan_id        => '1018',
-                address        => $ips['private1-b-eqiad'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-            # Row A subnets on eth1
-            interface::tagged { 'eth1.1001':
-                base_interface => 'eth1',
-                vlan_id        => '1001',
-                address        => $ips['public1-a-eqiad'][$::hostname],
-                netmask        => '255.255.255.192',
-            }
-            interface::tagged { 'eth1.1017':
-                base_interface => 'eth1',
-                vlan_id        => '1017',
-                address        => $ips['private1-a-eqiad'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-        }
-    }
-    # Row C subnets on eth2
-    interface::tagged { 'eth2.1003':
-        base_interface => 'eth2',
-        vlan_id        => '1003',
-        address        => $ips['public1-c-eqiad'][$::hostname],
-        netmask        => '255.255.255.192',
-    }
-    interface::tagged { 'eth2.1019':
-        base_interface => 'eth2',
-        vlan_id        => '1019',
-        address        => $ips['private1-c-eqiad'][$::hostname],
-        netmask        => '255.255.252.0',
-    }
-    # Row D subnets on eth3
-    interface::tagged { 'eth3.1004':
-        base_interface => 'eth3',
-        vlan_id        => '1004',
-        address        => $ips['public1-d-eqiad'][$::hostname],
-        netmask        => '255.255.255.224',
-    }
-    interface::tagged { 'eth3.1020':
-        base_interface => 'eth3',
-        vlan_id        => '1020',
-        address        => $ips['private1-d-eqiad'][$::hostname],
-        netmask        => '255.255.252.0',
-    }
 
     lvs::interface_tweaks {
         'eth0':;
@@ -1548,87 +1466,6 @@
     $nameservers_override = [ '208.80.154.157', '208.80.154.50', 
'208.80.153.254' ]
 
     role(lvs::balancer)
-
-    interface::add_ip6_mapped { 'main': }
-
-    include ::lvs::configuration
-    $ips = $lvs::configuration::subnet_ips
-
-    # Set up tagged interfaces to all subnets with real servers in them
-    # lint:ignore:case_without_default
-    case $::hostname {
-    # lint:endignore
-        /^lvs100[789]$/: {
-            # Row A subnets on eth0
-            interface::tagged { 'eth0.1001':
-                base_interface => 'eth0',
-                vlan_id        => '1001',
-                address        => $ips['public1-a-eqiad'][$::hostname],
-                netmask        => '255.255.255.192',
-            }
-            # Row C subnets on eth1
-            interface::tagged { 'eth1.1003':
-                base_interface => 'eth1',
-                vlan_id        => '1003',
-                address        => $ips['public1-c-eqiad'][$::hostname],
-                netmask        => '255.255.255.192',
-            }
-            interface::tagged { 'eth1.1019':
-                base_interface => 'eth1',
-                vlan_id        => '1019',
-                address        => $ips['private1-c-eqiad'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-        }
-        /^lvs101[012]$/: {
-            # Row C subnets on eth0
-            interface::tagged { 'eth0.1003':
-                base_interface => 'eth0',
-                vlan_id        => '1003',
-                address        => $ips['public1-c-eqiad'][$::hostname],
-                netmask        => '255.255.255.192',
-            }
-            # Row A subnets on eth1
-            interface::tagged { 'eth1.1001':
-                base_interface => 'eth1',
-                vlan_id        => '1001',
-                address        => $ips['public1-a-eqiad'][$::hostname],
-                netmask        => '255.255.255.192',
-            }
-            interface::tagged { 'eth1.1017':
-                base_interface => 'eth1',
-                vlan_id        => '1017',
-                address        => $ips['private1-a-eqiad'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-        }
-    }
-    # Row B subnets on eth2
-    interface::tagged { 'eth2.1002':
-        base_interface => 'eth2',
-        vlan_id        => '1002',
-        address        => $ips['public1-b-eqiad'][$::hostname],
-        netmask        => '255.255.255.192',
-    }
-    interface::tagged { 'eth2.1018':
-        base_interface => 'eth2',
-        vlan_id        => '1018',
-        address        => $ips['private1-b-eqiad'][$::hostname],
-        netmask        => '255.255.252.0',
-    }
-    # Row D subnets on eth3
-    interface::tagged { 'eth3.1004':
-        base_interface => 'eth3',
-        vlan_id        => '1004',
-        address        => $ips['public1-d-eqiad'][$::hostname],
-        netmask        => '255.255.255.224',
-    }
-    interface::tagged { 'eth3.1020':
-        base_interface => 'eth3',
-        vlan_id        => '1020',
-        address        => $ips['private1-d-eqiad'][$::hostname],
-        netmask        => '255.255.252.0',
-    }
 
     lvs::interface_tweaks {
         'eth0': bnx2x => true, txqlen => 10000;
@@ -1650,90 +1487,6 @@
     # (doing this for all lvs for now, see T103921)
     $nameservers_override = [ '208.80.153.12', '208.80.153.42', 
'208.80.154.254' ]
     role(lvs::balancer)
-
-    interface::add_ip6_mapped { 'main': }
-
-    include ::lvs::configuration
-    $ips = $lvs::configuration::subnet_ips
-
-    # Set up tagged interfaces to all subnets with real servers in them
-    # lint:ignore:case_without_default
-    case $::hostname {
-    # lint:endignore
-        /^lvs200[1-3]$/: {
-            # Row A subnets on eth0
-            interface::tagged { 'eth0.2001':
-                base_interface => 'eth0',
-                vlan_id        => '2001',
-                address        => $ips['public1-a-codfw'][$::hostname],
-                netmask        => '255.255.255.224',
-            }
-            # Row B subnets on eth1
-            interface::tagged { 'eth1.2002':
-                base_interface => 'eth1',
-                vlan_id        => '2002',
-                address        => $ips['public1-b-codfw'][$::hostname],
-                netmask        => '255.255.255.224',
-            }
-            interface::tagged { 'eth1.2018':
-                base_interface => 'eth1',
-                vlan_id        => '2018',
-                address        => $ips['private1-b-codfw'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-        }
-        /^lvs200[4-6]$/: {
-            # Row B subnets on eth0
-            interface::tagged { 'eth0.2002':
-                base_interface => 'eth0',
-                vlan_id        => '2002',
-                address        => $ips['public1-b-codfw'][$::hostname],
-                netmask        => '255.255.255.224',
-            }
-            # Row A subnets on eth1
-            interface::tagged { 'eth1.2001':
-                base_interface => 'eth1',
-                vlan_id        => '2001',
-                address        => $ips['public1-a-codfw'][$::hostname],
-                netmask        => '255.255.255.224',
-            }
-            interface::tagged { 'eth1.2017':
-                base_interface => 'eth1',
-                vlan_id        => '2017',
-                address        => $ips['private1-a-codfw'][$::hostname],
-                netmask        => '255.255.252.0',
-            }
-        }
-    }
-
-    # Row C subnets on eth2
-    interface::tagged { 'eth2.2003':
-        base_interface => 'eth2',
-        vlan_id        => '2003',
-        address        => $ips['public1-c-codfw'][$::hostname],
-        netmask        => '255.255.255.224',
-    }
-    interface::tagged { 'eth2.2019':
-        base_interface => 'eth2',
-        vlan_id        => '2019',
-        address        => $ips['private1-c-codfw'][$::hostname],
-        netmask        => '255.255.252.0',
-    }
-
-    # Row D subnets on eth3
-    interface::tagged { 'eth3.2004':
-        base_interface => 'eth3',
-        vlan_id        => '2004',
-        address        => $ips['public1-d-codfw'][$::hostname],
-        netmask        => '255.255.255.224',
-    }
-    interface::tagged { 'eth3.2020':
-        base_interface => 'eth3',
-        vlan_id        => '2020',
-        address        => $ips['private1-d-codfw'][$::hostname],
-        netmask        => '255.255.252.0',
-    }
-
     lvs::interface_tweaks {
         'eth0': bnx2x => true, txqlen => 10000;
         'eth1': bnx2x => true, txqlen => 10000;
@@ -1751,28 +1504,6 @@
     $nameservers_override = [ '91.198.174.106', '91.198.174.122', 
'208.80.154.254' ]
 
     role(lvs::balancer)
-
-    interface::add_ip6_mapped { 'main': }
-
-    include ::lvs::configuration
-    $ips = $lvs::configuration::subnet_ips
-
-    interface::tagged { 'eth0.100':
-        base_interface => 'eth0',
-        vlan_id        => '100',
-        address        => $ips['public1-esams'][$::hostname],
-        netmask        => '255.255.255.128',
-    }
-
-    # txqueuelen 20K for 10Gbps LVS in esams:
-    # Higher traffic than ulsfo. There is no perfect value based
-    #  on hardware alone, but this seems to get rid of common
-    #  spiky drops currently in esams.  The real answer is
-    #  probably a red or codel variant within each multiqueue
-    #  class, but we need a much newer kernel + driver to
-    #  be able to do that (both to get good schedulers
-    #  and driver updates for XPS).
-
     lvs::interface_tweaks {
         'eth0': bnx2x => true, txqlen => 20000;
     }
@@ -1784,9 +1515,6 @@
     $nameservers_override = [ '208.80.153.12', '208.80.153.42', 
'208.80.154.254' ]
 
     role(lvs::balancer)
-
-    interface::add_ip6_mapped { 'main': }
-
     lvs::interface_tweaks {
         'eth0': bnx2x => true, txqlen => 10000;
     }
diff --git a/modules/lvs/manifests/configuration.pp 
b/modules/lvs/manifests/configuration.pp
index ae3b195..38450f9 100644
--- a/modules/lvs/manifests/configuration.pp
+++ b/modules/lvs/manifests/configuration.pp
@@ -73,156 +73,4 @@
     $service_ips = hiera('lvs::configuration::lvs_service_ips')
     $lvs_services = hiera('lvs::configuration::lvs_services')
 
-    $subnet_ips = {
-        'public1-a-eqiad' => {
-            'lvs1004' => '208.80.154.58',
-            'lvs1005' => '208.80.154.59',
-            'lvs1006' => '208.80.154.60',
-            'lvs1007' => '208.80.154.43',
-            'lvs1008' => '208.80.154.44',
-            'lvs1009' => '208.80.154.45',
-            'lvs1010' => '208.80.154.46',
-        },
-        'public1-b-eqiad' => {
-            'lvs1001' => '208.80.154.140',
-            'lvs1002' => '208.80.154.141',
-            'lvs1003' => '208.80.154.142',
-            'lvs1007' => '208.80.154.161',
-            'lvs1008' => '208.80.154.162',
-            'lvs1009' => '208.80.154.163',
-            'lvs1010' => '208.80.154.164',
-        },
-        'public1-c-eqiad' => {
-            'lvs1001' => '208.80.154.78',
-            'lvs1002' => '208.80.154.68',
-            'lvs1003' => '208.80.154.69',
-            'lvs1004' => '208.80.154.70',
-            'lvs1005' => '208.80.154.71',
-            'lvs1006' => '208.80.154.72',
-            'lvs1007' => '208.80.154.96',
-            'lvs1008' => '208.80.154.97',
-            'lvs1009' => '208.80.154.98',
-            'lvs1010' => '208.80.154.99',
-        },
-        'public1-d-eqiad' => {
-            'lvs1001' => '208.80.155.100',
-            'lvs1002' => '208.80.155.101',
-            'lvs1003' => '208.80.155.102',
-            'lvs1004' => '208.80.155.103',
-            'lvs1005' => '208.80.155.104',
-            'lvs1006' => '208.80.155.105',
-            'lvs1007' => '208.80.155.111',
-            'lvs1008' => '208.80.155.112',
-            'lvs1009' => '208.80.155.113',
-            'lvs1010' => '208.80.155.114',
-        },
-        'private1-a-eqiad' => {
-            'lvs1001' => '10.64.1.1',
-            'lvs1002' => '10.64.1.2',
-            'lvs1003' => '10.64.1.3',
-            'lvs1004' => '10.64.1.4',
-            'lvs1005' => '10.64.1.5',
-            'lvs1006' => '10.64.1.6',
-            'lvs1010' => '10.64.1.10',
-        },
-        'private1-b-eqiad' => {
-            'lvs1001' => '10.64.17.1',
-            'lvs1002' => '10.64.17.2',
-            'lvs1003' => '10.64.17.3',
-            'lvs1004' => '10.64.17.4',
-            'lvs1005' => '10.64.17.5',
-            'lvs1006' => '10.64.17.6',
-            'lvs1007' => '10.64.17.7',
-            'lvs1008' => '10.64.17.8',
-            'lvs1009' => '10.64.17.9',
-            'lvs1010' => '10.64.17.10',
-        },
-        'private1-c-eqiad' => {
-            'lvs1001' => '10.64.33.1',
-            'lvs1002' => '10.64.33.2',
-            'lvs1003' => '10.64.33.3',
-            'lvs1004' => '10.64.33.4',
-            'lvs1005' => '10.64.33.5',
-            'lvs1006' => '10.64.33.6',
-            'lvs1007' => '10.64.33.7',
-            'lvs1008' => '10.64.33.8',
-            'lvs1009' => '10.64.33.9',
-        },
-        'private1-d-eqiad' => {
-            'lvs1001' => '10.64.49.1',
-            'lvs1002' => '10.64.49.2',
-            'lvs1003' => '10.64.49.3',
-            'lvs1004' => '10.64.49.4',
-            'lvs1005' => '10.64.49.5',
-            'lvs1006' => '10.64.49.6',
-            'lvs1007' => '10.64.49.7',
-            'lvs1008' => '10.64.49.8',
-            'lvs1009' => '10.64.49.9',
-            'lvs1010' => '10.64.49.10',
-        },
-        'public1-a-codfw' => {
-            'lvs2001' => '208.80.153.6',
-            'lvs2002' => '208.80.153.7',
-            'lvs2003' => '208.80.153.8',
-            'lvs2004' => '208.80.153.9',
-            'lvs2005' => '208.80.153.10',
-            'lvs2006' => '208.80.153.11',
-        },
-        'public1-b-codfw' => {
-            'lvs2001' => '208.80.153.39',
-            'lvs2002' => '208.80.153.40',
-            'lvs2003' => '208.80.153.41',
-            'lvs2004' => '208.80.153.36',
-            'lvs2005' => '208.80.153.37',
-            'lvs2006' => '208.80.153.38',
-        },
-        'public1-c-codfw' => {
-            'lvs2001' => '208.80.153.68',
-            'lvs2002' => '208.80.153.69',
-            'lvs2003' => '208.80.153.70',
-            'lvs2004' => '208.80.153.71',
-            'lvs2005' => '208.80.153.72',
-            'lvs2006' => '208.80.153.73',
-        },
-        'public1-d-codfw' => {
-            'lvs2001' => '208.80.153.100',
-            'lvs2002' => '208.80.153.101',
-            'lvs2003' => '208.80.153.102',
-            'lvs2004' => '208.80.153.103',
-            'lvs2005' => '208.80.153.104',
-            'lvs2006' => '208.80.153.105',
-        },
-        'private1-a-codfw' => {
-            'lvs2004' => '10.192.1.4',
-            'lvs2005' => '10.192.1.5',
-            'lvs2006' => '10.192.1.6',
-        },
-        'private1-b-codfw' => {
-            'lvs2001' => '10.192.17.1',
-            'lvs2002' => '10.192.17.2',
-            'lvs2003' => '10.192.17.3',
-        },
-        'private1-c-codfw' => {
-            'lvs2001' => '10.192.33.1',
-            'lvs2002' => '10.192.33.2',
-            'lvs2003' => '10.192.33.3',
-            'lvs2004' => '10.192.33.4',
-            'lvs2005' => '10.192.33.5',
-            'lvs2006' => '10.192.33.6',
-        },
-        'private1-d-codfw' => {
-            'lvs2001' => '10.192.49.1',
-            'lvs2002' => '10.192.49.2',
-            'lvs2003' => '10.192.49.3',
-            'lvs2004' => '10.192.49.4',
-            'lvs2005' => '10.192.49.5',
-            'lvs2006' => '10.192.49.6',
-        },
-        'public1-esams' => {
-            'lvs3001' => '91.198.174.11',
-            'lvs3002' => '91.198.174.12',
-            'lvs3003' => '91.198.174.13',
-            'lvs3004' => '91.198.174.14',
-        },
-    }
 }
diff --git a/modules/profile/manifests/lvs.pp b/modules/profile/manifests/lvs.pp
index 5461a11..75cd1a2 100644
--- a/modules/profile/manifests/lvs.pp
+++ b/modules/profile/manifests/lvs.pp
@@ -2,7 +2,10 @@
 #
 # Sets up a linux load-balancer.
 #
-class profile::lvs {
+class profile::lvs(
+    $tagged_subnets = hiera('profile::lvs::tagged_subnets'),
+    $vlan_data = hiera('lvs::interfaces::vlan_data'),
+){
     require ::lvs::configuration
 
     ## Kernel setup
@@ -13,6 +16,8 @@
     # kernel-level parameters
     class { '::lvs::kernel_config': }
 
+    # Network interfaces setup
+    interface::add_ip6_mapped { 'main': }
 
     ## LVS IPs setup
     # Obtain all the IPs configured for this class of load-balancers,
@@ -46,4 +51,10 @@
         replace => true,
     }
 
+    # Set up tagged interfaces to all subnets with real servers in them
+
+    profile::lvs::tagged_interface {$tagged_subnets:
+        interfaces => $vlan_data
+    }
+
 }
diff --git a/modules/profile/manifests/lvs/tagged_interface.pp 
b/modules/profile/manifests/lvs/tagged_interface.pp
new file mode 100644
index 0000000..dbc5639
--- /dev/null
+++ b/modules/profile/manifests/lvs/tagged_interface.pp
@@ -0,0 +1,19 @@
+define profile::lvs::tagged_interface($interfaces) {
+    warning($title)
+    warning($interfaces[$title])
+    $vlan_info = $interfaces[$title]
+    $vlan_id = $vlan_info['id']
+    if $::hostname in $vlan_info['iface'] {
+        $iface_str = $vlan_info['iface'][$::hostname]
+        $iface = split($iface_str, ':')
+        $tag = "${iface[0]}.${vlan_id}"
+
+        interface::tagged { $tag:
+            base_interface => $iface[0],
+            vlan_id        => $vlan_id,
+            address        => $iface[1],
+            netmask        => $vlan_info['netmask']
+        }
+
+    }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/358027
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0211669e8e9ae81b0d09ae22709fd3d0163f870
Gerrit-PatchSet: 12
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to