Version 0.0.1 of /fuel-bild
[genesis.git] / fuel-build / f_osnaily / puppet / modules / osnailyfacter / examples / site.pp.orig
1 $fuel_settings = parseyaml($astute_settings_yaml)
2
3 $openstack_version = {
4   'keystone'   => 'installed',
5   'glance'     => 'installed',
6   'horizon'    => 'installed',
7   'nova'       => 'installed',
8   'novncproxy' => 'installed',
9   'cinder'     => 'installed',
10 }
11
12 tag("${::fuel_settings['deployment_id']}::${::fuel_settings['environment']}")
13
14 #Stages configuration
15 stage {'zero': } ->
16 stage {'first': } ->
17 stage {'openstack-custom-repo': } ->
18 stage {'netconfig': } ->
19 stage {'corosync_setup': } ->
20 stage {'openstack-firewall': } -> Stage['main']
21
22 class begin_deployment ()
23 {
24   $role = $::fuel_settings['role']
25   notify { "***** Beginning deployment of node ${::hostname} with role $role *****": }
26 }
27
28 class {'begin_deployment': stage => 'zero' }
29
30 stage {'glance-image':
31   require => Stage['main'],
32 }
33
34 if $::fuel_settings['nodes'] {
35   $nodes_hash = $::fuel_settings['nodes']
36   $dns_nameservers=$::fuel_settings['dns_nameservers']
37   $node = filter_nodes($nodes_hash,'name',$::hostname)
38   if empty($node) {
39     fail("Node $::hostname is not defined in the hash structure")
40   }
41
42   $default_gateway = $node[0]['default_gateway']
43
44   $base_syslog_hash     = $::fuel_settings['base_syslog']
45   $syslog_hash          = $::fuel_settings['syslog']
46
47
48   $use_quantum = $::fuel_settings['quantum']
49   if (!empty(filter_nodes($::fuel_settings['nodes'], 'role', 'ceph-osd')) or
50     $::fuel_settings['storage']['volumes_ceph'] or
51     $::fuel_settings['storage']['images_ceph'] or
52     $::fuel_settings['storage']['objects_ceph']
53   ) {
54     $use_ceph = true
55   } else {
56     $use_ceph = false
57   }
58
59
60   if $use_quantum {
61     prepare_network_config($::fuel_settings['network_scheme'])
62     #
63     $internal_int     = get_network_role_property('management', 'interface')
64     $internal_address = get_network_role_property('management', 'ipaddr')
65     $internal_netmask = get_network_role_property('management', 'netmask')
66     #
67     $public_int = get_network_role_property('ex', 'interface')
68     if $public_int {
69       $public_address = get_network_role_property('ex', 'ipaddr')
70       $public_netmask = get_network_role_property('ex', 'netmask')
71     }
72     #
73     $storage_address = get_network_role_property('storage', 'ipaddr')
74     $storage_netmask = get_network_role_property('storage', 'netmask')
75   } else {
76     $internal_address = $node[0]['internal_address']
77     $internal_netmask = $node[0]['internal_netmask']
78     $public_address = $node[0]['public_address']
79     $public_netmask = $node[0]['public_netmask']
80     $storage_address = $node[0]['storage_address']
81     $storage_netmask = $node[0]['storage_netmask']
82     $public_br = $node[0]['public_br']
83     $internal_br = $node[0]['internal_br']
84     $public_int   = $::fuel_settings['public_interface']
85     $internal_int = $::fuel_settings['management_interface']
86   }
87 }
88
89 if ($::fuel_settings['neutron_mellanox']) {
90   $mellanox_mode = $::fuel_settings['neutron_mellanox']['plugin']
91 } else {
92   $mellanox_mode = 'disabled'
93 }
94
95 # This parameter specifies the verbosity level of log messages
96 # in openstack components config.
97 # Debug would have set DEBUG level and ignore verbose settings, if any.
98 # Verbose would have set INFO level messages
99 # In case of non debug and non verbose - WARNING, default level would have set.
100 $verbose = true
101 $debug = $::fuel_settings['debug']
102
103 ### Storage Settings ###
104 # Determine if any ceph parts have been asked for.
105 # This will ensure that monitors are set up on controllers, even if no
106 #  ceph-osd roles during deployment
107
108
109 ### Syslog ###
110 #TODO(bogdando) move logging options to astute.yaml
111 # Enable error messages reporting to rsyslog. Rsyslog must be installed in this case.
112 $use_syslog = $::fuel_settings['use_syslog'] ? { default=>true }
113 # Syslog facilities for main openstack services
114 # should vary (reserved usage)
115 # local1 is reserved for openstack-dashboard
116 $syslog_log_facility_glance     = 'LOG_LOCAL2'
117 $syslog_log_facility_cinder     = 'LOG_LOCAL3'
118 $syslog_log_facility_neutron    = 'LOG_LOCAL4'
119 $syslog_log_facility_nova       = 'LOG_LOCAL6'
120 $syslog_log_facility_keystone   = 'LOG_LOCAL7'
121 # could be the same
122 # local0 is free for use
123 $syslog_log_facility_murano     = 'LOG_LOCAL0'
124 $syslog_log_facility_heat       = 'LOG_LOCAL0'
125 $syslog_log_facility_sahara     = 'LOG_LOCAL0'
126 $syslog_log_facility_ceilometer = 'LOG_LOCAL0'
127
128 $nova_rate_limits = {
129   'POST' => 100000,
130   'POST_SERVERS' => 100000,
131   'PUT' => 1000, 'GET' => 100000,
132   'DELETE' => 100000
133 }
134 $cinder_rate_limits = {
135   'POST' => 100000,
136   'POST_SERVERS' => 100000,
137   'PUT' => 100000, 'GET' => 100000,
138   'DELETE' => 100000
139 }
140
141 ###
142 class advanced_node_netconfig {
143     $sdn = generate_network_config()
144     notify {"SDN: ${sdn}": }
145 }
146
147 case $::operatingsystem {
148   'redhat' : {
149     $queue_provider = 'qpid'
150     $custom_mysql_setup_class = 'pacemaker_mysql'
151   }
152   default: {
153     $queue_provider='rabbitmq'
154     $custom_mysql_setup_class='galera'
155   }
156 }
157
158 class os_common {
159   if ($::fuel_settings['neutron_mellanox']) and ($::fuel_settings['storage']['iser']) {
160       class { 'mellanox_openstack::iser_rename':
161                    stage => 'zero',
162                    storage_parent => $::fuel_settings['neutron_mellanox']['storage_parent'],
163                    iser_interface_name => $::fuel_settings['neutron_mellanox']['iser_interface_name'],
164       }
165   }
166   class {"l23network::hosts_file": stage => 'netconfig', nodes => $nodes_hash }
167   class {'l23network': use_ovs=>$use_quantum, stage=> 'netconfig'}
168   if $use_quantum {
169       class {'advanced_node_netconfig': stage => 'netconfig' }
170   } else {
171       class {'osnailyfacter::network_setup': stage => 'netconfig'}
172   }
173
174   class { 'openstack::firewall':
175     stage => 'openstack-firewall',
176     nova_vnc_ip_range => $::fuel_settings['management_network_range'],
177   }
178
179   $base_syslog_rserver  = {
180     'remote_type' => 'tcp',
181     'server' => $base_syslog_hash['syslog_server'],
182     'port' => $base_syslog_hash['syslog_port']
183   }
184
185 ### TCP connections keepalives and failover related parameters ###
186   # configure TCP keepalive for host OS.
187   # Send 3 probes each 8 seconds, if the connection was idle
188   # for a 30 seconds. Consider it dead, if there was no responces
189   # during the check time frame, i.e. 30+3*8=54 seconds overall.
190   # (note: overall check time frame should be lower then
191   # nova_report_interval).
192   class { 'openstack::keepalive' :
193     stage           => 'netconfig',
194     tcpka_time      => '30',
195     tcpka_probes    => '8',
196     tcpka_intvl     => '3',
197     tcp_retries2    => '5',
198   }
199
200   # setting kernel reserved ports
201   # defaults are 49000,35357,41055,58882
202   class { 'openstack::reserved_ports':
203     stage => 'netconfig',
204   }
205
206   # setting service down time and report interval
207   # to 60 and 180 for Nova respectively to allow kernel
208   # to kill dead connections
209   # (see zendesk #1158 as well)
210   $nova_report_interval = '60'
211   $nova_service_down_time  = '180'
212
213   $syslog_rserver = {
214     'remote_type' => $syslog_hash['syslog_transport'],
215     'server' => $syslog_hash['syslog_server'],
216     'port' => $syslog_hash['syslog_port'],
217   }
218   if $syslog_hash['syslog_server'] != "" and $syslog_hash['syslog_port'] != "" and $syslog_hash['syslog_transport'] != "" {
219     $rservers = [$base_syslog_rserver, $syslog_rserver]
220   } else {
221     $rservers = [$base_syslog_rserver]
222   }
223
224   if $use_syslog {
225     class { "::openstack::logging":
226       stage          => 'first',
227       role           => 'client',
228       show_timezone  => true,
229       # log both locally include auth, and remote
230       log_remote     => true,
231       log_local      => true,
232       log_auth_local => true,
233       # keep four weekly log rotations, force rotate if 300M size have exceeded
234       rotation       => 'weekly',
235       keep           => '4',
236       # should be > 30M
237       limitsize      => '300M',
238       # remote servers to send logs to
239       rservers       => $rservers,
240       # should be true, if client is running at virtual node
241       virtual        => str2bool($::is_virtual),
242       # Rabbit doesn't support syslog directly
243       rabbit_log_level => 'NOTICE',
244       debug            => $debug,
245     }
246   }
247
248   #case $role {
249     #    /controller/:          { $hostgroup = 'controller' }
250     #    /swift-proxy/: { $hostgroup = 'swift-proxy' }
251     #    /storage/:{ $hostgroup = 'swift-storage'  }
252     #    /compute/: { $hostgroup = 'compute'  }
253     #    /cinder/: { $hostgroup = 'cinder'  }
254     #    default: { $hostgroup = 'generic' }
255     #}
256
257     #  if $nagios != 'false' {
258     #  class {'nagios':
259     #    proj_name       => $proj_name,
260     #    services        => [
261     #      'host-alive','nova-novncproxy','keystone', 'nova-scheduler',
262     #      'nova-consoleauth', 'nova-cert', 'haproxy', 'nova-api', 'glance-api',
263     #      'glance-registry','horizon', 'rabbitmq', 'mysql',
264     #    ],
265     #    whitelist       => ['127.0.0.1', $nagios_master],
266     #    hostgroup       => $hostgroup ,
267     #  }
268     # }
269
270   # Workaround for fuel bug with firewall
271   firewall {'003 remote rabbitmq ':
272     sport   => [ 4369, 5672, 15672, 41055, 55672, 61613 ],
273     source  => $::fuel_settings['master_ip'],
274     proto   => 'tcp',
275     action  => 'accept',
276     require => Class['openstack::firewall'],
277   }
278
279   firewall {'004 remote puppet ':
280     sport   => [ 8140 ],
281     source  => $master_ip,
282     proto   => 'tcp',
283     action  => 'accept',
284     require => Class['openstack::firewall'],
285   }
286
287   class { 'puppet::pull' :
288     master_ip => $::fuel_settings['master_ip'],
289   }
290 } # OS_COMMON ENDS
291
292
293
294 node default {
295   case $::fuel_settings['deployment_mode'] {
296     "singlenode": {
297       include "osnailyfacter::cluster_simple"
298       class {'os_common':}
299       }
300     "multinode": {
301       include "osnailyfacter::cluster_simple"
302       class {'os_common':}
303       }
304     /^(ha|ha_compact)$/: {
305       include "osnailyfacter::cluster_ha"
306       class {'os_common':}
307       class {'corosync::commitorder': stage=>'main'}
308       }
309     "rpmcache": { include osnailyfacter::rpmcache }
310   }
311 }