Merge "Autodeployer support for ODL Plugin installation + Fuel 6.1"
[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   $disable_offload      = $::fuel_settings['disable_offload']
48   if $disable_offload {
49     L23network::L3::Ifconfig<||> {
50       ethtool =>     {
51         'K' => ['gso off',  'gro off'],
52       }
53     }
54   }
55
56   $use_neutron = $::fuel_settings['quantum']
57
58   if (!empty(filter_nodes($::fuel_settings['nodes'], 'role', 'ceph-osd')) or
59     $::fuel_settings['storage']['volumes_ceph'] or
60     $::fuel_settings['storage']['images_ceph'] or
61     $::fuel_settings['storage']['objects_ceph']
62   ) {
63     $use_ceph = true
64   } else {
65     $use_ceph = false
66   }
67
68
69   if $use_neutron {
70     prepare_network_config($::fuel_settings['network_scheme'])
71     #
72     $internal_int     = get_network_role_property('management', 'interface')
73     $internal_address = get_network_role_property('management', 'ipaddr')
74     $internal_netmask = get_network_role_property('management', 'netmask')
75     #
76     $public_int = get_network_role_property('ex', 'interface')
77     if $public_int {
78       $public_address = get_network_role_property('ex', 'ipaddr')
79       $public_netmask = get_network_role_property('ex', 'netmask')
80
81       # TODO(Xarses): remove this after completing merge of
82       # multiple-cluster-networks
83       L23network::L3::Ifconfig<| title == $public_int |> {
84         default_gateway => true
85       }
86     } else {
87       # TODO(Xarses): remove this after completing merge of
88       # multiple-cluster-networks
89       $fw_admin_int = get_network_role_property('fw-admin', 'interface')
90       L23network::L3::Ifconfig<| title == $fw_admin_int |> {
91         default_gateway => true
92       }
93     }
94     #
95     $storage_address = get_network_role_property('storage', 'ipaddr')
96     $storage_netmask = get_network_role_property('storage', 'netmask')
97   } else {
98     $internal_address = $node[0]['internal_address']
99     $internal_netmask = $node[0]['internal_netmask']
100     $public_address = $node[0]['public_address']
101     $public_netmask = $node[0]['public_netmask']
102     $storage_address = $node[0]['storage_address']
103     $storage_netmask = $node[0]['storage_netmask']
104     $public_br = $node[0]['public_br']
105     $internal_br = $node[0]['internal_br']
106     $public_int   = $::fuel_settings['public_interface']
107     $internal_int = $::fuel_settings['management_interface']
108
109     # TODO(Xarses): remove this after completing merge of
110     # multiple-cluster-networks
111     L23network::L3::Ifconfig<| title == $public_int |> {
112       default_gateway => true
113     }
114
115   }
116 }
117
118 if ($::fuel_settings['neutron_mellanox']) {
119   $mellanox_mode = $::fuel_settings['neutron_mellanox']['plugin']
120 } else {
121   $mellanox_mode = 'disabled'
122 }
123
124 # This parameter specifies the verbosity level of log messages
125 # in openstack components config.
126 # Debug would have set DEBUG level and ignore verbose settings, if any.
127 # Verbose would have set INFO level messages
128 # In case of non debug and non verbose - WARNING, default level would have set.
129 $verbose = true
130 $debug = $::fuel_settings['debug']
131
132 ### Storage Settings ###
133 # Determine if any ceph parts have been asked for.
134 # This will ensure that monitors are set up on controllers, even if no
135 #  ceph-osd roles during deployment
136
137
138 ### Syslog ###
139 #TODO(bogdando) move logging options to astute.yaml
140 # Enable error messages reporting to rsyslog. Rsyslog must be installed in this case.
141 $use_syslog = $::fuel_settings['use_syslog'] ? { default=>true }
142 # Syslog facilities for main openstack services
143 # should vary (reserved usage)
144 # local1 is reserved for openstack-dashboard
145 $syslog_log_facility_glance     = 'LOG_LOCAL2'
146 $syslog_log_facility_cinder     = 'LOG_LOCAL3'
147 $syslog_log_facility_neutron    = 'LOG_LOCAL4'
148 $syslog_log_facility_nova       = 'LOG_LOCAL6'
149 $syslog_log_facility_keystone   = 'LOG_LOCAL7'
150 # could be the same
151 # local0 is free for use
152 $syslog_log_facility_murano     = 'LOG_LOCAL0'
153 $syslog_log_facility_heat       = 'LOG_LOCAL0'
154 $syslog_log_facility_sahara     = 'LOG_LOCAL0'
155 $syslog_log_facility_ceilometer = 'LOG_LOCAL0'
156 $syslog_log_facility_ceph       = 'LOG_LOCAL0'
157
158 ### Monit ###
159 # Monit for compute nodes.
160 # If enabled, will install monit and configure its watchdogs to track
161 # nova-compute/api/network (and openvswitch service, if neutron enabled)
162 # at compute nodes.
163 # TODO(bogdando) set to true once monit package shipped with Fuel ISO
164 $use_monit = false
165
166 $nova_rate_limits = {
167   'POST' => 100000,
168   'POST_SERVERS' => 100000,
169   'PUT' => 1000, 'GET' => 100000,
170   'DELETE' => 100000
171 }
172 $cinder_rate_limits = {
173   'POST' => 100000,
174   'POST_SERVERS' => 100000,
175   'PUT' => 100000, 'GET' => 100000,
176   'DELETE' => 100000
177 }
178
179 ###
180 class advanced_node_netconfig {
181     $sdn = generate_network_config()
182     notify {"SDN: ${sdn}": }
183 }
184
185 case $::operatingsystem {
186   'redhat' : {
187     $queue_provider = 'qpid'
188     $custom_mysql_setup_class = 'pacemaker_mysql'
189   }
190   default: {
191     $queue_provider='rabbitmq'
192     $custom_mysql_setup_class='galera'
193   }
194 }
195
196 class os_common {
197   if ($::fuel_settings['neutron_mellanox']) {
198     if ($::mellanox_mode != 'disabled') {
199       class { 'mellanox_openstack::ofed_recompile' :
200         stage => 'zero',
201       }
202     }
203     if ($::fuel_settings['storage']['iser']) {
204       class { 'mellanox_openstack::iser_rename':
205         stage => 'zero',
206         storage_parent => $::fuel_settings['neutron_mellanox']['storage_parent'],
207         iser_interface_name => $::fuel_settings['neutron_mellanox']['iser_interface_name'],
208       }
209       Class['mellanox_openstack::ofed_recompile'] -> Class['mellanox_openstack::iser_rename']
210     }
211   }
212
213   class {"l23network::hosts_file": stage => 'netconfig', nodes => $nodes_hash }
214   class {'l23network': use_ovs=>$use_neutron, stage=> 'netconfig'}
215   if $use_neutron {
216       class {'advanced_node_netconfig': stage => 'netconfig' }
217   } else {
218       class {'osnailyfacter::network_setup': stage => 'netconfig'}
219   }
220
221   if ($::osfamily == 'RedHat') {
222     package {'irqbalance': ensure => present} -> service {'irqbalance': ensure => running }
223   }
224
225   class { 'openstack::firewall':
226     stage => 'openstack-firewall',
227     nova_vnc_ip_range => $::fuel_settings['management_network_range'],
228   }
229
230   $base_syslog_rserver  = {
231     'remote_type' => 'tcp',
232     'server' => $base_syslog_hash['syslog_server'],
233     'port' => $base_syslog_hash['syslog_port']
234   }
235
236   # setting kernel reserved ports
237   # defaults are 49000,35357,41055,58882
238   class { 'openstack::reserved_ports':
239     stage => 'netconfig',
240   }
241
242   # setting service down time and report interval
243   # to 60 and 180 for Nova respectively to allow kernel
244   # to kill dead connections
245   # (see zendesk #1158 as well)
246   $nova_report_interval = '60'
247   $nova_service_down_time  = '180'
248
249   $syslog_rserver = {
250     'remote_type' => $syslog_hash['syslog_transport'],
251     'server' => $syslog_hash['syslog_server'],
252     'port' => $syslog_hash['syslog_port'],
253   }
254   if $syslog_hash['syslog_server'] != "" and $syslog_hash['syslog_port'] != "" and $syslog_hash['syslog_transport'] != "" {
255     $rservers = [$base_syslog_rserver, $syslog_rserver]
256   } else {
257     $rservers = [$base_syslog_rserver]
258   }
259
260   if $use_syslog {
261     class { "::openstack::logging":
262       stage          => 'first',
263       role           => 'client',
264       show_timezone  => true,
265       # log both locally include auth, and remote
266       log_remote     => true,
267       log_local      => true,
268       log_auth_local => true,
269       # keep four weekly log rotations, force rotate if 300M size have exceeded
270       rotation       => 'weekly',
271       keep           => '4',
272       minsize        => '10M',
273       maxsize        => '100M',
274       # remote servers to send logs to
275       rservers       => $rservers,
276       # should be true, if client is running at virtual node
277       virtual        => str2bool($::is_virtual),
278       # Rabbit doesn't support syslog directly
279       rabbit_log_level => 'NOTICE',
280       debug            => $debug,
281     }
282   }
283
284   class { 'osnailyfacter::atop':
285     stage => 'first',
286   }
287
288   class { 'osnailyfacter::ssh': }
289
290   #case $role {
291     #    /controller/:          { $hostgroup = 'controller' }
292     #    /swift-proxy/: { $hostgroup = 'swift-proxy' }
293     #    /storage/:{ $hostgroup = 'swift-storage'  }
294     #    /compute/: { $hostgroup = 'compute'  }
295     #    /cinder/: { $hostgroup = 'cinder'  }
296     #    default: { $hostgroup = 'generic' }
297     #}
298
299     #  if $nagios != 'false' {
300     #  class {'nagios':
301     #    proj_name       => $proj_name,
302     #    services        => [
303     #      'host-alive','nova-novncproxy','keystone', 'nova-scheduler',
304     #      'nova-consoleauth', 'nova-cert', 'haproxy', 'nova-api', 'glance-api',
305     #      'glance-registry','horizon', 'rabbitmq', 'mysql',
306     #    ],
307     #    whitelist       => ['127.0.0.1', $nagios_master],
308     #    hostgroup       => $hostgroup ,
309     #  }
310     # }
311
312   # Workaround for fuel bug with firewall
313   firewall {'003 remote rabbitmq ':
314     sport   => [ 4369, 5672, 15672, 41055, 55672, 61613 ],
315     source  => $::fuel_settings['master_ip'],
316     proto   => 'tcp',
317     action  => 'accept',
318     require => Class['openstack::firewall'],
319   }
320
321   firewall {'004 remote puppet ':
322     sport   => [ 8140 ],
323     source  => $master_ip,
324     proto   => 'tcp',
325     action  => 'accept',
326     require => Class['openstack::firewall'],
327   }
328
329   class { 'puppet::pull' :
330     modules_source   => $::fuel_settings['puppet_modules_source'],
331     manifests_source => $::fuel_settings['puppet_manifests_source'],
332   }
333 } # OS_COMMON ENDS
334
335
336
337 node default {
338   case $::fuel_settings['deployment_mode'] {
339     "singlenode": {
340       include "osnailyfacter::cluster_simple"
341       class {'os_common':}
342       }
343     "multinode": {
344       include "osnailyfacter::cluster_simple"
345       class {'os_common':}
346       }
347     /^(ha|ha_compact)$/: {
348       include "osnailyfacter::cluster_ha"
349       class {'os_common':}
350       }
351     "rpmcache": { include osnailyfacter::rpmcache }
352   }
353 }