Use new verify job type with new freestyle project
[releng/builder.git] / vagrant / lib / lf-networking / confignetwork.pp
1 # make system modifications to handle being on a private Rackspace network
2
3 # lint:ignore:80chars
4 notice ("Operating system detected is: '${::operatingsystem} ${::operatingsystemrelease}'")
5 # lint:endignore
6 notice ("Subdomain being used is: '${::subdomain}'")
7
8 # configure nameservers for domains
9 case $::subdomain {
10   /^dfw\./: {
11     $ns1 = '72.3.128.241'
12     $ns2 = '72.3.128.240'
13     case $::subdomain {
14       /opendaylight/: {
15         $router = '10.30.11.1'
16       }
17       /odlforge/: {
18         $router = '10.30.12.1'
19       }
20       default: {
21         fail("Unrecognized subdomain ${::subdomain}")
22       }
23     }
24   }
25   /^ord\./: {
26     $ns1 = '173.203.4.9'
27     $ns2 = '173.203.4.8'
28     $router = '10.30.32.1'
29   }
30   default: {
31     fail("Unrecognized subdomain ${::subdomain}")
32   }
33 }
34
35 # dnsmasq
36 class { 'dnsmasq': }
37
38 # Setup dnsmasq special domain handlers
39 dnsmasq::conf { 'LF-ns1':
40   ensure  => present,
41   content => 'server=/linux-foundation.org/172.17.192.30',
42 }
43
44 dnsmasq::conf { 'LF-ns2':
45   ensure  => present,
46   content => 'server=/linux-foundation.org/172.17.192.31',
47 }
48
49 dnsmasq::conf { 'ODL-ns1':
50   ensure  => present,
51   content => 'server=/opendaylight.org/172.17.192.30',
52 }
53
54 dnsmasq::conf { 'ODL-ns2':
55   ensure  => present,
56   content => 'server=/opendaylight.org/172.17.192.31',
57 }
58
59 dnsmasq::conf { 'ODLForge-ns1':
60   ensure  => present,
61   content => 'server=/odlforge.org/172.17.192.30',
62 }
63
64 dnsmasq::conf { 'ODLForge-ns2':
65   ensure  => present,
66   content => 'server=/odlforge.org/172.17.192.31',
67 }
68
69 # fix the resolver
70 file { '/etc/resolv.conf':
71   content => "search ${::subdomain}
72 nameserver 127.0.0.1
73 nameserver ${ns1}
74 nameserver ${ns2}
75 options timeout:2
76 ",
77 }
78
79 file { '/etc/cloud/cloud.cfg.d/00_lf_resolv.cfg':
80   content => "#cloud-config
81
82 manage_resolv_conf: true
83
84 resolv_conf:
85   nameservers: ['127.0.0.1', '${ns1}', '${ns2}']
86   searchdomains:
87     - ${::subdomain}
88   options:
89     timeout: 2
90 ",
91 }
92
93 file_line { 'add_resolver':
94   path       => $::operatingsystem ? {
95     'Ubuntu' => '/etc/cloud/cloud.cfg',
96     default  => '/etc/cloud/cloud.cfg.d/10_rackspace.cfg',
97   },
98   line  => ' - resolv_conf',
99   after => ' - update_etc_hosts',
100 }
101
102 # OS specific configuration
103 case $::operatingsystem {
104   'CentOS', 'Fedora', 'RedHat': {
105     file { '/etc/sysconfig/network-scripts/route-eth0':
106       content => "default via ${router} dev eth0",
107     }
108
109     # disable the DNS peerage so that our resolv.conf doesn't
110     # get destroyed
111     file_line { 'disable_peerdns':
112       path => '/etc/sysconfig/network',
113       line => 'PEERDNS=no',
114     }
115   }
116   'Ubuntu': {
117     file { '/etc/network/if-up.d/0000routing':
118       content => "#!/bin/sh\nip route add default via ${router} dev eth0",
119       mode    => '0755',
120     }
121
122     file { '/etc/resolvconf/resolv.conf.d/tail':
123       content => "# opendaylight dns
124 nameserver ${ns1}
125 nameserver ${ns2}
126 ",
127     }
128   }
129   default: {
130     notice ("${::operatingsystem} is not supported by this configuration")
131   }
132 }