diff options
-rw-r--r-- | manifests/profile/base/database/mysql.pp | 2 | ||||
-rw-r--r-- | manifests/profile/base/haproxy.pp | 50 | ||||
-rw-r--r-- | manifests/profile/base/heat.pp | 2 | ||||
-rw-r--r-- | manifests/profile/base/pacemaker.pp | 6 | ||||
-rw-r--r-- | manifests/profile/base/swift/add_devices.pp | 59 | ||||
-rw-r--r-- | manifests/profile/base/swift/ringbuilder.pp | 77 | ||||
-rw-r--r-- | manifests/profile/pacemaker/database/mysql.pp | 6 | ||||
-rw-r--r-- | manifests/profile/pacemaker/database/redis.pp | 4 | ||||
-rw-r--r-- | manifests/profile/pacemaker/gnocchi.pp | 15 | ||||
-rw-r--r-- | manifests/profile/pacemaker/gnocchi/api.pp | 1 | ||||
-rw-r--r-- | manifests/profile/pacemaker/keystone.pp | 1 |
11 files changed, 207 insertions, 16 deletions
diff --git a/manifests/profile/base/database/mysql.pp b/manifests/profile/base/database/mysql.pp index 9552e10..27df6e4 100644 --- a/manifests/profile/base/database/mysql.pp +++ b/manifests/profile/base/database/mysql.pp @@ -52,7 +52,7 @@ class tripleo::profile::base::database::mysql ( # ha scenario $mysql_step = 1 } - if hiera('step') >= $mysql_step { + if $step >= $mysql_step { if str2bool(hiera('enable_galera', true)) { $mysql_config_file = '/etc/my.cnf.d/galera.cnf' } else { diff --git a/manifests/profile/base/haproxy.pp b/manifests/profile/base/haproxy.pp index 31a5415..8e73ce3 100644 --- a/manifests/profile/base/haproxy.pp +++ b/manifests/profile/base/haproxy.pp @@ -27,13 +27,59 @@ # (Optional) Whether or not loadbalancer is enabled. # Defaults to hiera('enable_load_balancer', true). # +# [*generate_service_certificates*] +# (Optional) Whether or not certmonger will generate certificates for +# HAProxy. This could be as many as specified by the $certificates_specs +# variable. +# Note that this doesn't configure the certificates in haproxy, it merely +# creates the certificates. +# Defaults to hiera('generate_service_certificate', false). +# +# [*certmonger_ca*] +# (Optional) The CA that certmonger will use to generate the certificates. +# Defaults to hiera('certmonger_ca', 'local'). +# +# [*certificates_specs*] +# (Optional) The specifications to give to certmonger for the certificate(s) +# it will create. +# Example with hiera: +# tripleo::profile::base::haproxy::certificates_specs: +# undercloud-haproxy-public-cert: +# service_pem: <haproxy ready pem file> +# service_certificate: <service certificate path> +# service_key: <service key path> +# hostname: <undercloud fqdn> +# postsave_cmd: <command to update certificate on resubmit> +# principal: "haproxy/<undercloud fqdn>" +# Defaults to {}. +# class tripleo::profile::base::haproxy ( - $enable_load_balancer = hiera('enable_load_balancer', true), - $step = hiera('step'), + $enable_load_balancer = hiera('enable_load_balancer', true), + $step = hiera('step'), + $generate_service_certificates = hiera('generate_service_certificates', false), + $certmonger_ca = hiera('certmonger_ca', 'local'), + $certificates_specs = {}, ) { if $step >= 1 { if $enable_load_balancer { + if str2bool($generate_service_certificates) { + include ::certmonger + # This is only needed for certmonger's local CA. For any other CA this + # operation (trusting the CA) should be done by the deployer. + if $certmonger_ca == 'local' { + include ::tripleo::certmonger::ca::local + } + + Certmonger_certificate { + ca => $certmonger_ca, + ensure => 'present', + wait => true, + require => Class['::certmonger'], + } + create_resources('::tripleo::certmonger::haproxy', $certificates_specs) + } + include ::tripleo::haproxy } } diff --git a/manifests/profile/base/heat.pp b/manifests/profile/base/heat.pp index fa0e2f1..1311f20 100644 --- a/manifests/profile/base/heat.pp +++ b/manifests/profile/base/heat.pp @@ -44,7 +44,7 @@ class tripleo::profile::base::heat ( # Domain resources will be created at step5 on the pacemaker_master so we # configure heat.conf at step3 and 4 but actually create the domain later. - if hiera('step') == 3 or hiera('step') == 4 { + if $step == 3 or $step == 4 { class { '::heat::keystone::domain': manage_domain => false, manage_user => false, diff --git a/manifests/profile/base/pacemaker.pp b/manifests/profile/base/pacemaker.pp index de107a9..1785656 100644 --- a/manifests/profile/base/pacemaker.pp +++ b/manifests/profile/base/pacemaker.pp @@ -38,9 +38,9 @@ class tripleo::profile::base::pacemaker ( $pacemaker_master = false } - $enable_fencing = str2bool(hiera('enable_fencing', false)) and hiera('step') >= 5 + $enable_fencing = str2bool(hiera('enable_fencing', false)) and $step >= 5 - if hiera('step') >= 1 { + if $step >= 1 { $pacemaker_cluster_members = downcase(regsubst(hiera('controller_node_names'), ',', ' ', 'G')) $corosync_ipv6 = str2bool(hiera('corosync_ipv6', false)) if $corosync_ipv6 { @@ -78,7 +78,7 @@ class tripleo::profile::base::pacemaker ( } } - if hiera('step') >= 2 { + if $step >= 2 { if $pacemaker_master { include ::pacemaker::resource_defaults diff --git a/manifests/profile/base/swift/add_devices.pp b/manifests/profile/base/swift/add_devices.pp new file mode 100644 index 0000000..f61f418 --- /dev/null +++ b/manifests/profile/base/swift/add_devices.pp @@ -0,0 +1,59 @@ +# Copyright 2015 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# == Function: tripleo::profile::base::swift::add_devices +# +# Swift add_devices helper function +# +# === Parameters +# +# [*swift_zones*] +# (Optional) The number of swift zones. + +define tripleo::profile::base::swift::add_devices( + $swift_zones = '1' +){ + + # NOTE(dprince): Swift zones is not yet properly wired into the Heat + # templates. See: https://review.openstack.org/#/c/97758/3 + # For now our regex supports the r1z1-192.0.2.6:%PORT%/d1 syntax or the + # newer r1z%<controller or SwiftStorage><N>%-192.0.2.6:%PORT%/d1 syntax. + $server_num_or_device = regsubst($name,'^r1z%+[A-Za-z]*([0-9]+)%+-(.*)$','\1') + if (is_integer($server_num_or_device)) { + $server_num = $server_num_or_device + } else { + $server_num = '1' + } + # Function to place server in its zone. Zone is calculated by + # server number in heat template modulo the number of zones + 1. + $zone = (($server_num%$swift_zones) + 1) + + # add the rings + $base = regsubst($name,'^r1.*-(.*)$','\1') + $object = regsubst($base, '%PORT%', '6000') + ring_object_device { $object: + zone => '1', + weight => 100, + } + $container = regsubst($base, '%PORT%', '6001') + ring_container_device { $container: + zone => '1', + weight => 100, + } + $account = regsubst($base, '%PORT%', '6002') + ring_account_device { $account: + zone => '1', + weight => 100, + } +} diff --git a/manifests/profile/base/swift/ringbuilder.pp b/manifests/profile/base/swift/ringbuilder.pp new file mode 100644 index 0000000..d94c6be --- /dev/null +++ b/manifests/profile/base/swift/ringbuilder.pp @@ -0,0 +1,77 @@ +# Copyright 2015 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# == Class: tripleo::profile::base::swift::ringbuilder +# +# Swift ringbuilder profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# [*swift_zones*] +# (Optional) The swift zones +# Defaults to 1 +# [*devices*] +# (Optional) The swift devices +# Defaults to '' +# [*build_ring*] = true, +# (Optional) Whether to build the ring +# Defaults to true +# [*replicas*] +# replicas + +class tripleo::profile::base::swift::ringbuilder ( + $step = hiera('step'), + $swift_zones = '1', + $devices = '', + $build_ring = true, + $replicas, +) { + + if $step >= 2 { + # pre-install swift here so we can build rings + include ::swift + } + + if $step >= 3 { + validate_bool($build_ring) + + if $build_ring { + + $device_array = strip(split(rstrip($devices), ',')) + + # create local rings + swift::ringbuilder::create{ ['object', 'account', 'container']: + replicas => min(count($device_array), $replicas), + } -> + + # add all other devices + tripleo::profile::base::swift::add_devices {$device_array: + swift_zones => $swift_zones, + } -> + + # rebalance + swift::ringbuilder::rebalance{ ['object', 'account', 'container']: + seed => 999, + } + + Ring_object_device<| |> ~> Exec['rebalance_object'] + Ring_object_device<| |> ~> Exec['rebalance_account'] + Ring_object_device<| |> ~> Exec['rebalance_container'] + } + } +} diff --git a/manifests/profile/pacemaker/database/mysql.pp b/manifests/profile/pacemaker/database/mysql.pp index 1acdf0d..80015d0 100644 --- a/manifests/profile/pacemaker/database/mysql.pp +++ b/manifests/profile/pacemaker/database/mysql.pp @@ -72,7 +72,7 @@ class tripleo::profile::pacemaker::database::mysql ( mysql_server_options => $mysqld_options, } - if hiera('step') >= 2 and $pacemaker_master { + if $step >= 2 and $pacemaker_master { if $pacemaker_master { pacemaker::resource::ocf { 'galera' : ocf_agent_name => 'heartbeat:galera', @@ -129,7 +129,7 @@ class tripleo::profile::pacemaker::database::mysql ( } } - if hiera('step') >= 4 or ( hiera('step') >= 3 and $pacemaker_master ) { + if $step >= 4 or ( $step >= 3 and $pacemaker_master ) { # At this stage we are guaranteed that the clustercheck db user exists # so we switch the resource agent to use it. $mysql_clustercheck_password = hiera('mysql_clustercheck_password') @@ -144,7 +144,7 @@ MYSQL_HOST=localhost\n", } } - if hiera('step') >= 5 { + if $step >= 5 { # We now make sure that the root db password is set to a random one # At first installation /root/.my.cnf will be empty and we connect without a root # password. On second runs or updates /root/.my.cnf will already be populated diff --git a/manifests/profile/pacemaker/database/redis.pp b/manifests/profile/pacemaker/database/redis.pp index 9bb96ae..27dcbe9 100644 --- a/manifests/profile/pacemaker/database/redis.pp +++ b/manifests/profile/pacemaker/database/redis.pp @@ -18,9 +18,6 @@ # # === Parameters # -# [*redis_vip*] -# Redis virtual IP -# # [*bootstrap_node*] # (Optional) The hostname of the node responsible for bootstrapping tasks # Defaults to hiera('bootstrap_nodeid') @@ -36,7 +33,6 @@ # class tripleo::profile::pacemaker::database::redis ( - $redis_vip, $bootstrap_node = hiera('bootstrap_nodeid'), $enable_load_balancer = hiera('enable_load_balancer', true), $step = hiera('step'), diff --git a/manifests/profile/pacemaker/gnocchi.pp b/manifests/profile/pacemaker/gnocchi.pp index 98d1b36..c8630ce 100644 --- a/manifests/profile/pacemaker/gnocchi.pp +++ b/manifests/profile/pacemaker/gnocchi.pp @@ -59,15 +59,26 @@ class tripleo::profile::pacemaker::gnocchi ( } } - if $step >= 3 and $pacemaker_master { + if $step >= 3 { include ::gnocchi include ::gnocchi::config include ::gnocchi::client - include ::gnocchi::db::sync + if $pacemaker_master { + include ::gnocchi::db::sync + } } if $step >= 5 and $pacemaker_master { + pacemaker::constraint::base { 'keystone-then-gnocchi-metricd-constraint': + constraint_type => 'order', + first_resource => 'openstack-core-clone', + second_resource => "${::gnocchi::params::metricd_service_name}-clone", + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service[$::gnocchi::params::metricd_service_name], + Pacemaker::Resource::Ocf['openstack-core']], + } pacemaker::constraint::base { 'gnocchi-metricd-then-gnocchi-statsd-constraint': constraint_type => 'order', first_resource => "${::gnocchi::params::metricd_service_name}-clone", diff --git a/manifests/profile/pacemaker/gnocchi/api.pp b/manifests/profile/pacemaker/gnocchi/api.pp index da65731..ede4c9a 100644 --- a/manifests/profile/pacemaker/gnocchi/api.pp +++ b/manifests/profile/pacemaker/gnocchi/api.pp @@ -28,6 +28,7 @@ class tripleo::profile::pacemaker::gnocchi::api ( ) { include ::tripleo::profile::pacemaker::gnocchi + include ::tripleo::profile::pacemaker::apache class { '::tripleo::profile::base::gnocchi::api': step => $step, diff --git a/manifests/profile/pacemaker/keystone.pp b/manifests/profile/pacemaker/keystone.pp index e8e12a3..1cd5178 100644 --- a/manifests/profile/pacemaker/keystone.pp +++ b/manifests/profile/pacemaker/keystone.pp @@ -51,6 +51,7 @@ class tripleo::profile::pacemaker::keystone ( } include ::tripleo::profile::base::keystone + include ::tripleo::profile::pacemaker::apache if $step >= 5 and $pacemaker_master and $enable_load_balancer { pacemaker::constraint::base { 'haproxy-then-keystone-constraint': |