summaryrefslogtreecommitdiffstats
path: root/fuel-build/f_osnaily/puppet/modules/osnailyfacter/examples/site.pp
blob: c32a92b52227541b138d0e7c3f94d936bfc02331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
$fuel_settings = parseyaml($astute_settings_yaml)

$openstack_version = {
  'keystone'   => 'installed',
  'glance'     => 'installed',
  'horizon'    => 'installed',
  'nova'       => 'installed',
  'novncproxy' => 'installed',
  'cinder'     => 'installed',
}

tag("${::fuel_settings['deployment_id']}::${::fuel_settings['environment']}")

#Stages configuration
stage {'zero': } ->
stage {'opncheck': } ->
stage {'first': } ->
stage {'openstack-custom-repo': } ->
stage {'netconfig': } ->
stage {'corosync_setup': } ->
stage {'openstack-firewall': } -> Stage['main']

class begin_deployment ()
{
  $role = $::fuel_settings['role']
  notify { "***** Beginning deployment of node ${::hostname} with role $role *****": }
}

class {'begin_deployment': stage => 'zero' }

stage {'glance-image':
  require => Stage['main'],
}

if $::fuel_settings['nodes'] {
  $nodes_hash = $::fuel_settings['nodes']
# OPNFV addition to add to hosts file
  if ($::fuel_settings['opnfv'] and
    $::fuel_settings['opnfv']['hosts']) {
    $extras_hash = $::fuel_settings['opnfv']['hosts']
  } else {
    $extras_hash = undef
  }

  $dns_nameservers=$::fuel_settings['dns_nameservers']
  $node = filter_nodes($nodes_hash,'name',$::hostname)
  if empty($node) {
    fail("Node $::hostname is not defined in the hash structure")
  }

  $default_gateway = $node[0]['default_gateway']

  $base_syslog_hash     = $::fuel_settings['base_syslog']
  $syslog_hash          = $::fuel_settings['syslog']


  $use_quantum = $::fuel_settings['quantum']
  if (!empty(filter_nodes($::fuel_settings['nodes'], 'role', 'ceph-osd')) or
    $::fuel_settings['storage']['volumes_ceph'] or
    $::fuel_settings['storage']['images_ceph'] or
    $::fuel_settings['storage']['objects_ceph']
  ) {
    $use_ceph = true
  } else {
    $use_ceph = false
  }


  if $use_quantum {
    prepare_network_config($::fuel_settings['network_scheme'])
    #
    $internal_int     = get_network_role_property('management', 'interface')
    $internal_address = get_network_role_property('management', 'ipaddr')
    $internal_netmask = get_network_role_property('management', 'netmask')
    #
    $public_int = get_network_role_property('ex', 'interface')
    if $public_int {
      $public_address = get_network_role_property('ex', 'ipaddr')
      $public_netmask = get_network_role_property('ex', 'netmask')
    }
    #
    $storage_address = get_network_role_property('storage', 'ipaddr')
    $storage_netmask = get_network_role_property('storage', 'netmask')
  } else {
    $internal_address = $node[0]['internal_address']
    $internal_netmask = $node[0]['internal_netmask']
    $public_address = $node[0]['public_address']
    $public_netmask = $node[0]['public_netmask']
    $storage_address = $node[0]['storage_address']
    $storage_netmask = $node[0]['storage_netmask']
    $public_br = $node[0]['public_br']
    $internal_br = $node[0]['internal_br']
    $public_int   = $::fuel_settings['public_interface']
    $internal_int = $::fuel_settings['management_interface']
  }
}

if ($::fuel_settings['neutron_mellanox']) {
  $mellanox_mode = $::fuel_settings['neutron_mellanox']['plugin']
} else {
  $mellanox_mode = 'disabled'
}

# This parameter specifies the verbosity level of log messages
# in openstack components config.
# Debug would have set DEBUG level and ignore verbose settings, if any.
# Verbose would have set INFO level messages
# In case of non debug and non verbose - WARNING, default level would have set.
$verbose = true
$debug = $::fuel_settings['debug']

### Storage Settings ###
# Determine if any ceph parts have been asked for.
# This will ensure that monitors are set up on controllers, even if no
#  ceph-osd roles during deployment


### Syslog ###
#TODO(bogdando) move logging options to astute.yaml
# Enable error messages reporting to rsyslog. Rsyslog must be installed in this case.
$use_syslog = $::fuel_settings['use_syslog'] ? { default=>true }
# Syslog facilities for main openstack services
# should vary (reserved usage)
# local1 is reserved for openstack-dashboard
$syslog_log_facility_glance     = 'LOG_LOCAL2'
$syslog_log_facility_cinder     = 'LOG_LOCAL3'
$syslog_log_facility_neutron    = 'LOG_LOCAL4'
$syslog_log_facility_nova       = 'LOG_LOCAL6'
$syslog_log_facility_keystone   = 'LOG_LOCAL7'
# could be the same
# local0 is free for use
$syslog_log_facility_murano     = 'LOG_LOCAL0'
$syslog_log_facility_heat       = 'LOG_LOCAL0'
$syslog_log_facility_sahara     = 'LOG_LOCAL0'
$syslog_log_facility_ceilometer = 'LOG_LOCAL0'

$nova_rate_limits = {
  'POST' => 100000,
  'POST_SERVERS' => 100000,
  'PUT' => 1000, 'GET' => 100000,
  'DELETE' => 100000
}
$cinder_rate_limits = {
  'POST' => 100000,
  'POST_SERVERS' => 100000,
  'PUT' => 100000, 'GET' => 100000,
  'DELETE' => 100000
}

###
class advanced_node_netconfig {
    $sdn = generate_network_config()
    notify {"SDN: ${sdn}": }
}

case $::operatingsystem {
  'redhat' : {
    $queue_provider = 'qpid'
    $custom_mysql_setup_class = 'pacemaker_mysql'
  }
  default: {
    $queue_provider='rabbitmq'
    $custom_mysql_setup_class='galera'
  }
}

class os_common {
  # OPNFV check if pre_deploy.sh has been run, otherwise fail
  class {'opnfv::opncheck': stage => 'opncheck' }
  if ($::fuel_settings['neutron_mellanox']) and ($::fuel_settings['storage']['iser']) {
      class { 'mellanox_openstack::iser_rename':
                   stage => 'zero',
                   storage_parent => $::fuel_settings['neutron_mellanox']['storage_parent'],
                   iser_interface_name => $::fuel_settings['neutron_mellanox']['iser_interface_name'],
      }
  }
  class {"l23network::hosts_file": stage => 'netconfig', nodes => $nodes_hash, extras => $extras_hash }
  class {'l23network': use_ovs=>$use_quantum, stage=> 'netconfig'}
  if $use_quantum {
      class {'advanced_node_netconfig': stage => 'netconfig' }
  } else {
      class {'osnailyfacter::network_setup': stage => 'netconfig'}
  }

  class { 'openstack::firewall':
    stage => 'openstack-firewall',
    nova_vnc_ip_range => $::fuel_settings['management_network_range'],
  }

  $base_syslog_rserver  = {
    'remote_type' => 'tcp',
    'server' => $base_syslog_hash['syslog_server'],
    'port' => $base_syslog_hash['syslog_port']
  }

### TCP connections keepalives and failover related parameters ###
  # configure TCP keepalive for host OS.
  # Send 3 probes each 8 seconds, if the connection was idle
  # for a 30 seconds. Consider it dead, if there was no responces
  # during the check time frame, i.e. 30+3*8=54 seconds overall.
  # (note: overall check time frame should be lower then
  # nova_report_interval).
  class { 'openstack::keepalive' :
    stage           => 'netconfig',
    tcpka_time      => '30',
    tcpka_probes    => '8',
    tcpka_intvl     => '3',
    tcp_retries2    => '5',
  }

  # setting kernel reserved ports
  # defaults are 49000,35357,41055,58882
  class { 'openstack::reserved_ports':
    stage => 'netconfig',
  }

  # setting service down time and report interval
  # to 60 and 180 for Nova respectively to allow kernel
  # to kill dead connections
  # (see zendesk #1158 as well)
  $nova_report_interval = '60'
  $nova_service_down_time  = '180'

  $syslog_rserver = {
    'remote_type' => $syslog_hash['syslog_transport'],
    'server' => $syslog_hash['syslog_server'],
    'port' => $syslog_hash['syslog_port'],
  }
  if $syslog_hash['syslog_server'] != "" and $syslog_hash['syslog_port'] != "" and $syslog_hash['syslog_transport'] != "" {
    $rservers = [$base_syslog_rserver, $syslog_rserver]
  } else {
    $rservers = [$base_syslog_rserver]
  }

  if $use_syslog {
    class { "::openstack::logging":
      stage          => 'first',
      role           => 'client',
      show_timezone  => true,
      # log both locally include auth, and remote
      log_remote     => true,
      log_local      => true,
      log_auth_local => true,
      # keep four weekly log rotations, force rotate if 300M size have exceeded
      rotation       => 'weekly',
      keep           => '4',
      # should be > 30M
      limitsize      => '300M',
      # remote servers to send logs to
      rservers       => $rservers,
      # should be true, if client is running at virtual node
      virtual        => str2bool($::is_virtual),
      # Rabbit doesn't support syslog directly
      rabbit_log_level => 'NOTICE',
      debug            => $debug,
    }
  }

  #case $role {
    #    /controller/:          { $hostgroup = 'controller' }
    #    /swift-proxy/: { $hostgroup = 'swift-proxy' }
    #    /storage/:{ $hostgroup = 'swift-storage'  }
    #    /compute/: { $hostgroup = 'compute'  }
    #    /cinder/: { $hostgroup = 'cinder'  }
    #    default: { $hostgroup = 'generic' }
    #}

    #  if $nagios != 'false' {
    #  class {'nagios':
    #    proj_name       => $proj_name,
    #    services        => [
    #      'host-alive','nova-novncproxy','keystone', 'nova-scheduler',
    #      'nova-consoleauth', 'nova-cert', 'haproxy', 'nova-api', 'glance-api',
    #      'glance-registry','horizon', 'rabbitmq', 'mysql',
    #    ],
    #    whitelist       => ['127.0.0.1', $nagios_master],
    #    hostgroup       => $hostgroup ,
    #  }
    # }

  # Workaround for fuel bug with firewall
  firewall {'003 remote rabbitmq ':
    sport   => [ 4369, 5672, 15672, 41055, 55672, 61613 ],
    source  => $::fuel_settings['master_ip'],
    proto   => 'tcp',
    action  => 'accept',
    require => Class['openstack::firewall'],
  }

  firewall {'004 remote puppet ':
    sport   => [ 8140 ],
    source  => $master_ip,
    proto   => 'tcp',
    action  => 'accept',
    require => Class['openstack::firewall'],
  }

  class { 'puppet::pull' :
    master_ip => $::fuel_settings['master_ip'],
  }
} # OS_COMMON ENDS



node default {
  case $::fuel_settings['deployment_mode'] {
    "singlenode": {
      include "osnailyfacter::cluster_simple"
      class {'os_common':}
      class {'opnfv':}
      }
    "multinode": {
      include "osnailyfacter::cluster_simple"
      class {'os_common':}
      class {'opnfv':}
      }
    /^(ha|ha_compact)$/: {
      include "osnailyfacter::cluster_ha"
      class {'os_common':}
      class {'corosync::commitorder': stage=>'main'}
      class {'opnfv':}
      }
    "rpmcache": { include osnailyfacter::rpmcache }
  }
}