aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/pacemaker
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/profile/pacemaker')
-rw-r--r--manifests/profile/pacemaker/database/mysql_bundle.pp302
-rw-r--r--manifests/profile/pacemaker/database/redis.pp31
-rw-r--r--manifests/profile/pacemaker/database/redis_bundle.pp178
-rw-r--r--manifests/profile/pacemaker/haproxy_bundle.pp196
-rw-r--r--manifests/profile/pacemaker/neutron/lbaas.pp44
-rw-r--r--manifests/profile/pacemaker/rabbitmq.pp8
-rw-r--r--manifests/profile/pacemaker/rabbitmq_bundle.pp194
7 files changed, 936 insertions, 17 deletions
diff --git a/manifests/profile/pacemaker/database/mysql_bundle.pp b/manifests/profile/pacemaker/database/mysql_bundle.pp
new file mode 100644
index 0000000..451d7f7
--- /dev/null
+++ b/manifests/profile/pacemaker/database/mysql_bundle.pp
@@ -0,0 +1,302 @@
+# Copyright 2017 Red Hat, Inc.
+#
+# 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::pacemaker::mysql_bundle
+#
+# Containerized Mysql Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*mysql_docker_image*]
+# (Optional) The docker image to use for creating the pacemaker bundle
+# Defaults to hiera('tripleo::profile::pacemaker::database::redis_bundle::mysql_docker_image', undef)
+#
+# [*control_port*]
+# (Optional) The bundle's pacemaker_remote control port on the host
+# Defaults to hiera('tripleo::profile::pacemaker::database::redis_bundle::control_port', '3123')
+#
+# [*bootstrap_node*]
+# (Optional) The hostname of the node responsible for bootstrapping tasks
+# Defaults to hiera('mysql_short_bootstrap_node_name')
+#
+# [*bind_address*]
+# (Optional) The address that the local mysql instance should bind to.
+# Defaults to $::hostname
+#
+# [*gmcast_listen_addr*]
+# (Optional) This variable defines the address on which the node listens to
+# connections from other nodes in the cluster.
+# Defaults to hiera('mysql_bind_host')
+#
+# [*pcs_tries*]
+# (Optional) The number of times pcs commands should be retried.
+# Defaults to hiera('pcs_tries', 20)
+#
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
+#
+#
+class tripleo::profile::pacemaker::database::mysql_bundle (
+ $mysql_docker_image = hiera('tripleo::profile::pacemaker::database::mysql_bundle::mysql_docker_image', undef),
+ $control_port = hiera('tripleo::profile::pacemaker::database::mysql_bundle::control_port', '3123'),
+ $bootstrap_node = hiera('mysql_short_bootstrap_node_name'),
+ $bind_address = $::hostname,
+ $gmcast_listen_addr = hiera('mysql_bind_host'),
+ $pcs_tries = hiera('pcs_tries', 20),
+ $step = hiera('step'),
+) {
+ if $::hostname == downcase($bootstrap_node) {
+ $pacemaker_master = true
+ } else {
+ $pacemaker_master = false
+ }
+
+ # use only mysql_node_names when we land a patch in t-h-t that
+ # switches to autogenerating these values from composable services
+ # The galera node names need to match the pacemaker node names... so if we
+ # want to use FQDNs for this, the cluster will not finish bootstrapping,
+ # since all the nodes will be marked as slaves. For now, we'll stick to the
+ # short name which is already registered in pacemaker until we get around
+ # this issue.
+ $galera_node_names_lookup = hiera('mysql_short_node_names', hiera('mysql_node_names', $::hostname))
+ if is_array($galera_node_names_lookup) {
+ $galera_nodes = downcase(join($galera_node_names_lookup, ','))
+ } else {
+ $galera_nodes = downcase($galera_node_names_lookup)
+ }
+ $galera_nodes_array = split($galera_nodes, ',')
+ $galera_nodes_count = count($galera_nodes_array)
+
+ # construct a galera-pacemaker name mapping for the resource agent
+ # [galera-bundle-0:galera_node[0], galera-bundle-1:galera_node[1], ... ,galera-bundle-n:galera_node[n]]
+ $host_map_array = $galera_nodes_array.map |$i, $host| {
+ "galera-bundle-${i}:${host}"
+ }
+ $cluster_host_map_string = join($host_map_array, ';')
+
+ $mysqld_options = {
+ 'mysqld' => {
+ 'pid-file' => '/var/lib/mysql/mariadb.pid',
+ 'skip-name-resolve' => '1',
+ 'binlog_format' => 'ROW',
+ 'default-storage-engine' => 'innodb',
+ 'innodb_autoinc_lock_mode' => '2',
+ 'innodb_locks_unsafe_for_binlog'=> '1',
+ 'innodb_file_per_table' => 'ON',
+ 'query_cache_size' => '0',
+ 'query_cache_type' => '0',
+ 'bind-address' => $bind_address,
+ 'max_connections' => hiera('mysql_max_connections'),
+ 'open_files_limit' => '-1',
+ 'wsrep_on' => 'ON',
+ 'wsrep_provider' => '/usr/lib64/galera/libgalera_smm.so',
+ 'wsrep_cluster_name' => 'galera_cluster',
+ 'wsrep_cluster_address' => "gcomm://${galera_nodes}",
+ 'wsrep_slave_threads' => '1',
+ 'wsrep_certify_nonPK' => '1',
+ 'wsrep_max_ws_rows' => '131072',
+ 'wsrep_max_ws_size' => '1073741824',
+ 'wsrep_debug' => '0',
+ 'wsrep_convert_LOCK_to_trx' => '0',
+ 'wsrep_retry_autocommit' => '1',
+ 'wsrep_auto_increment_control' => '1',
+ 'wsrep_drupal_282555_workaround'=> '0',
+ 'wsrep_causal_reads' => '0',
+ 'wsrep_sst_method' => 'rsync',
+ 'wsrep_provider_options' => "gmcast.listen_addr=tcp://${gmcast_listen_addr}:4567;",
+ },
+ 'mysqld_safe' => {
+ 'pid-file' => '/var/lib/mysql/mariadb.pid',
+ }
+ }
+
+ # remove_default_accounts parameter will execute some mysql commands
+ # to remove the default accounts created by MySQL package.
+ # We need MySQL running to run the commands successfully, so better to
+ # wait step 2 before trying to run the commands.
+ if $step >= 2 and $pacemaker_master {
+ $remove_default_accounts = true
+ } else {
+ $remove_default_accounts = false
+ }
+
+ if $step >= 1 and $pacemaker_master and hiera('stack_action') == 'UPDATE' {
+ tripleo::pacemaker::resource_restart_flag { 'galera-master':
+ subscribe => File['mysql-config-file'],
+ }
+ }
+
+ $mysql_root_password = hiera('mysql::server::root_password')
+
+ if $step >= 1 {
+ # Kolla sets the root password, expose it to the MySQL package
+ # so that it can initialize the database (e.g. create users)
+ file { '/root/.my.cnf' :
+ ensure => file,
+ mode => '0600',
+ owner => 'root',
+ group => 'root',
+ content => "[client]
+user=root
+password=\"${mysql_root_password}\"
+
+[mysql]
+user=root
+password=\"${mysql_root_password}\"",
+ }
+
+ # Resource agent uses those credentials to poll galera state
+ file { '/etc/sysconfig/clustercheck' :
+ ensure => file,
+ mode => '0600',
+ owner => 'root',
+ group => 'root',
+ content => "MYSQL_USERNAME=root\n
+MYSQL_PASSWORD='${mysql_root_password}'\n
+MYSQL_HOST=localhost\n",
+ }
+ }
+
+ if $step >= 2 {
+ # need that class to create all openstack credentials
+ # we don't include it in step 1 because the kolla bootstrap
+ # happens after step 1 baremetal
+ class { '::tripleo::profile::base::database::mysql':
+ bootstrap_node => $bootstrap_node,
+ manage_resources => false,
+ remove_default_accounts => $remove_default_accounts,
+ mysql_server_options => $mysqld_options,
+ }
+
+ if $pacemaker_master {
+ $mysql_short_node_names = hiera('mysql_short_node_names')
+ $mysql_short_node_names.each |String $node_name| {
+ # lint:ignore:puppet-lint-2.0.1 does not work with multiline strings
+ # and blocks (remove this when we move to 2.2.0 where this works)
+ pacemaker::property { "galera-role-${node_name}":
+ property => 'galera-role',
+ value => true,
+ tries => $pcs_tries,
+ node => $node_name,
+ before => Pacemaker::Resource::Bundle['galera-bundle'],
+ }
+ # lint:endignore
+ }
+ pacemaker::resource::bundle { 'galera-bundle':
+ image => $mysql_docker_image,
+ replicas => $galera_nodes_count,
+ masters => $galera_nodes_count,
+ container_options => 'network=host',
+ options => '--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS',
+ run_command => '/bin/bash /usr/local/bin/kolla_start',
+ network => "control-port=${control_port}",
+ storage_maps => {
+ 'mysql-cfg-files' => {
+ 'source-dir' => '/var/lib/kolla/config_files/mysql.json',
+ 'target-dir' => '/var/lib/kolla/config_files/config.json',
+ 'options' => 'ro',
+ },
+ 'mysql-cfg-data' => {
+ 'source-dir' => '/var/lib/config-data/mysql',
+ 'target-dir' => '/var/lib/kolla/config_files/src',
+ 'options' => 'ro',
+ },
+ 'mysql-hosts' => {
+ 'source-dir' => '/etc/hosts',
+ 'target-dir' => '/etc/hosts',
+ 'options' => 'ro',
+ },
+ 'mysql-localtime' => {
+ 'source-dir' => '/etc/localtime',
+ 'target-dir' => '/etc/localtime',
+ 'options' => 'ro',
+ },
+ 'mysql-lib' => {
+ 'source-dir' => '/var/lib/mysql',
+ 'target-dir' => '/var/lib/mysql',
+ 'options' => 'rw',
+ },
+ 'mysql-log-mariadb' => {
+ 'source-dir' => '/var/log/mariadb',
+ 'target-dir' => '/var/log/mariadb',
+ 'options' => 'rw',
+ },
+ 'mysql-pki-extracted' => {
+ 'source-dir' => '/etc/pki/ca-trust/extracted',
+ 'target-dir' => '/etc/pki/ca-trust/extracted',
+ 'options' => 'ro',
+ },
+ 'mysql-pki-ca-bundle-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'options' => 'ro',
+ },
+ 'mysql-pki-ca-bundle-trust-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'options' => 'ro',
+ },
+ 'mysql-pki-cert' => {
+ 'source-dir' => '/etc/pki/tls/cert.pem',
+ 'target-dir' => '/etc/pki/tls/cert.pem',
+ 'options' => 'ro',
+ },
+ 'mysql-dev-log' => {
+ 'source-dir' => '/dev/log',
+ 'target-dir' => '/dev/log',
+ 'options' => 'rw',
+ },
+ },
+ }
+
+ pacemaker::resource::ocf { 'galera':
+ ocf_agent_name => 'heartbeat:galera',
+ master_params => '',
+ meta_params => "master-max=${galera_nodes_count} ordered=true",
+ op_params => 'promote timeout=300s on-fail=block',
+ resource_params => "additional_parameters='--open-files-limit=16384' enable_creation=true wsrep_cluster_address='gcomm://${galera_nodes}' cluster_host_map='${cluster_host_map_string}'",
+ tries => $pcs_tries,
+ location_rule => {
+ resource_discovery => 'exclusive',
+ score => 0,
+ expression => ['galera-role eq true'],
+ },
+ bundle => 'galera-bundle',
+ require => [Class['::mysql::server'],
+ Pacemaker::Resource::Bundle['galera-bundle']],
+ before => Exec['galera-ready'],
+ }
+
+ exec { 'galera-ready' :
+ command => '/usr/bin/clustercheck >/dev/null',
+ timeout => 30,
+ tries => 180,
+ try_sleep => 10,
+ environment => ['AVAILABLE_WHEN_READONLY=0'],
+ tag => 'galera_ready'
+ }
+
+ # We create databases and users for services at step 2 as well. This ensures
+ # Galera is up and ready before those get created
+ File['/root/.my.cnf'] -> Mysql_database<||>
+ File['/root/.my.cnf'] -> Mysql_user<||>
+ File['/etc/sysconfig/clustercheck'] -> Mysql_database<||>
+ File['/etc/sysconfig/clustercheck'] -> Mysql_user<||>
+ Exec['galera-ready'] -> Mysql_database<||>
+ Exec['galera-ready'] -> Mysql_user<||>
+ }
+ }
+}
diff --git a/manifests/profile/pacemaker/database/redis.pp b/manifests/profile/pacemaker/database/redis.pp
index 3ef6815..4f5a861 100644
--- a/manifests/profile/pacemaker/database/redis.pp
+++ b/manifests/profile/pacemaker/database/redis.pp
@@ -32,9 +32,12 @@
# Defaults to hiera('step')
#
# [*redis_file_limit*]
-# (Optional) The file limit to put in /etc/security/limits.d/redis.conf
+# (Deprecated) The file limit to put in /etc/security/limits.d/redis.conf
# for when redis is managed by pacemaker. Defaults to hiera('redis_file_limit')
-# or 10240 (default in redis systemd limits)
+# or 10240 (default in redis systemd limits). Note this option is deprecated
+# since puppet-redis grew support for ulimits in cluster configurations.
+# https://github.com/arioch/puppet-redis/pull/192. Set redis::ulimit via hiera
+# to control this limit.
#
# [*pcs_tries*]
# (Optional) The number of times pcs commands should be retried.
@@ -44,7 +47,7 @@ class tripleo::profile::pacemaker::database::redis (
$bootstrap_node = hiera('redis_short_bootstrap_node_name'),
$enable_load_balancer = hiera('enable_load_balancer', true),
$step = hiera('step'),
- $redis_file_limit = hiera('redis_file_limit', 10240),
+ $redis_file_limit = undef,
$pcs_tries = hiera('pcs_tries', 20),
) {
if $::hostname == downcase($bootstrap_node) {
@@ -54,19 +57,17 @@ class tripleo::profile::pacemaker::database::redis (
}
if $step >= 1 {
- include ::redis
- # Until puppet-redis grows support for /etc/security/limits.conf/redis.conf
- # https://github.com/arioch/puppet-redis/issues/130
- # we best explicitely set the file limit only in the pacemaker profile
- # (the base profile does not need it as it is using systemd which has
- # the limits set there)
- file { '/etc/security/limits.d/redis.conf':
- content => inline_template("redis soft nofile <%= @redis_file_limit %>\nredis hard nofile <%= @redis_file_limit %>\n"),
- owner => '0',
- group => '0',
- mode => '0644',
+ # If the old hiera key exists we use that to set the ulimit in order not to break
+ # operators which set it. We might remove this in a later release (post pike anyway)
+ $old_redis_file_limit = hiera('redis_file_limit', undef)
+ if $old_redis_file_limit != undef {
+ warning('redis_file_limit parameter is deprecated, use redis::ulimit in hiera.')
+ class { '::redis':
+ ulimit => $old_redis_file_limit,
+ }
+ } else {
+ include ::redis
}
-
if $pacemaker_master and hiera('stack_action') == 'UPDATE' {
tripleo::pacemaker::resource_restart_flag { 'redis-master':
# ouch, but trying to stay close how notification works in
diff --git a/manifests/profile/pacemaker/database/redis_bundle.pp b/manifests/profile/pacemaker/database/redis_bundle.pp
new file mode 100644
index 0000000..167e54a
--- /dev/null
+++ b/manifests/profile/pacemaker/database/redis_bundle.pp
@@ -0,0 +1,178 @@
+# Copyright 2017 Red Hat, Inc.
+#
+# 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::pacemaker::database::redis_bundle
+#
+# Containerized Redis Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*redis_docker_image*]
+# (Optional) The docker image to use for creating the pacemaker bundle
+# Defaults to hiera('tripleo::profile::pacemaker::redis_bundle::redis_docker_image', undef)
+#
+# [*redis_docker_control_port*]
+# (Optional) The bundle's pacemaker_remote control port on the host
+# Defaults to hiera('tripleo::profile::pacemaker::redis_bundle::control_port', '3121')
+#
+# [*pcs_tries*]
+# (Optional) The number of times pcs commands should be retried.
+# Defaults to hiera('pcs_tries', 20)
+#
+# [*bootstrap_node*]
+# (Optional) The hostname of the node responsible for bootstrapping tasks
+# Defaults to hiera('redis_short_bootstrap_node_name')
+#
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
+#
+#
+class tripleo::profile::pacemaker::database::redis_bundle (
+ $bootstrap_node = hiera('redis_short_bootstrap_node_name'),
+ $redis_docker_image = hiera('tripleo::profile::pacemaker::database::redis_bundle::redis_docker_image', undef),
+ $redis_docker_control_port = hiera('tripleo::profile::pacemaker::database::redis_bundle::control_port', '3124'),
+ $pcs_tries = hiera('pcs_tries', 20),
+ $step = hiera('step'),
+) {
+ if $::hostname == downcase($bootstrap_node) {
+ $pacemaker_master = true
+ } else {
+ $pacemaker_master = false
+ }
+
+ include ::tripleo::profile::base::database::redis
+
+ if $step >= 2 {
+ if $pacemaker_master {
+ $redis_short_node_names = hiera('redis_short_node_names')
+ $redis_nodes_count = count($redis_short_node_names)
+ $redis_short_node_names.each |String $node_name| {
+ pacemaker::property { "redis-role-${node_name}":
+ property => 'redis-role',
+ value => true,
+ tries => $pcs_tries,
+ node => $node_name,
+ before => Pacemaker::Resource::Bundle['redis-bundle'],
+ }
+ }
+
+ pacemaker::resource::bundle { 'redis-bundle':
+ image => $redis_docker_image,
+ replicas => $redis_nodes_count,
+ masters => 1,
+ container_options => 'network=host',
+ options => '--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS',
+ run_command => '/bin/bash /usr/local/bin/kolla_start',
+ network => "control-port=${redis_docker_control_port}",
+ storage_maps => {
+ 'redis-cfg-files' => {
+ 'source-dir' => '/var/lib/kolla/config_files/redis.json',
+ 'target-dir' => '/var/lib/kolla/config_files/config.json',
+ 'options' => 'ro',
+ },
+ 'redis-cfg-data-redis' => {
+ 'source-dir' => '/var/lib/config-data/redis/etc/redis',
+ 'target-dir' => '/etc/redis',
+ 'options' => 'ro',
+ },
+ 'redis-cfg-data-redis-conf' => {
+ 'source-dir' => '/var/lib/config-data/redis/etc/redis.conf',
+ 'target-dir' => '/etc/redis.conf',
+ 'options' => 'ro',
+ },
+ 'redis-cfg-data-redis-conf-puppet' => {
+ 'source-dir' => '/var/lib/config-data/redis/etc/redis.conf.puppet',
+ 'target-dir' => '/etc/redis.conf.puppet',
+ 'options' => 'ro',
+ },
+ 'redis-cfg-data-redis-sentinel' => {
+ 'source-dir' => '/var/lib/config-data/redis/etc/redis-sentinel.conf',
+ 'target-dir' => '/etc/redis-sentinel.conf',
+ 'options' => 'ro',
+ },
+ 'redis-hosts' => {
+ 'source-dir' => '/etc/hosts',
+ 'target-dir' => '/etc/hosts',
+ 'options' => 'ro',
+ },
+ 'redis-localtime' => {
+ 'source-dir' => '/etc/localtime',
+ 'target-dir' => '/etc/localtime',
+ 'options' => 'ro',
+ },
+ 'redis-lib' => {
+ 'source-dir' => '/var/lib/redis',
+ 'target-dir' => '/var/lib/redis',
+ 'options' => 'rw',
+ },
+ 'redis-log' => {
+ 'source-dir' => '/var/log/redis',
+ 'target-dir' => '/var/log/redis',
+ 'options' => 'rw',
+ },
+ 'redis-run' => {
+ 'source-dir' => '/var/run/redis',
+ 'target-dir' => '/var/run/redis',
+ 'options' => 'rw',
+ },
+ 'redis-pki-extracted' => {
+ 'source-dir' => '/etc/pki/ca-trust/extracted',
+ 'target-dir' => '/etc/pki/ca-trust/extracted',
+ 'options' => 'ro',
+ },
+ 'redis-pki-ca-bundle-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'options' => 'ro',
+ },
+ 'redis-pki-ca-bundle-trust-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'options' => 'ro',
+ },
+ 'redis-pki-cert' => {
+ 'source-dir' => '/etc/pki/tls/cert.pem',
+ 'target-dir' => '/etc/pki/tls/cert.pem',
+ 'options' => 'ro',
+ },
+ 'redis-dev-log' => {
+ 'source-dir' => '/dev/log',
+ 'target-dir' => '/dev/log',
+ 'options' => 'rw',
+ },
+ },
+ }
+
+ pacemaker::resource::ocf { 'redis':
+ ocf_agent_name => 'heartbeat:redis',
+ resource_params => 'wait_last_known_master=true',
+ master_params => '',
+ meta_params => 'notify=true ordered=true interleave=true',
+ op_params => 'start timeout=200s stop timeout=200s',
+ tries => $pcs_tries,
+ location_rule => {
+ resource_discovery => 'exclusive',
+ score => 0,
+ expression => ['redis-role eq true'],
+ },
+ bundle => 'redis-bundle',
+ require => [Class['::redis'],
+ Pacemaker::Resource::Bundle['redis-bundle']],
+ }
+
+ }
+ }
+}
diff --git a/manifests/profile/pacemaker/haproxy_bundle.pp b/manifests/profile/pacemaker/haproxy_bundle.pp
new file mode 100644
index 0000000..3e7b7dd
--- /dev/null
+++ b/manifests/profile/pacemaker/haproxy_bundle.pp
@@ -0,0 +1,196 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# 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::pacemaker::haproxy
+#
+# HAproxy with Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*haproxy_docker_image*]
+# (Optional) The docker image to use for creating the pacemaker bundle
+# Defaults to hiera('tripleo::profile::pacemaker::haproxy::haproxy_docker_image', undef)
+#
+# [*bootstrap_node*]
+# (Optional) The hostname of the node responsible for bootstrapping tasks
+# Defaults to hiera('haproxy_short_bootstrap_node_name')
+#
+# [*enable_load_balancer*]
+# (Optional) Whether load balancing is enabled for this cluster
+# Defaults to hiera('enable_load_balancer', true)
+#
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
+#
+# [*pcs_tries*]
+# (Optional) The number of times pcs commands should be retried.
+# Defaults to hiera('pcs_tries', 20)
+#
+class tripleo::profile::pacemaker::haproxy_bundle (
+ $haproxy_docker_image = hiera('tripleo::profile::pacemaker::haproxy::haproxy_docker_image', undef),
+ $bootstrap_node = hiera('haproxy_short_bootstrap_node_name'),
+ $enable_load_balancer = hiera('enable_load_balancer', true),
+ $step = hiera('step'),
+ $pcs_tries = hiera('pcs_tries', 20),
+) {
+ include ::tripleo::profile::base::haproxy
+
+ if $::hostname == downcase($bootstrap_node) {
+ $pacemaker_master = true
+ } else {
+ $pacemaker_master = false
+ }
+
+ if $step >= 1 and $pacemaker_master and hiera('stack_action') == 'UPDATE' and $enable_load_balancer {
+ tripleo::pacemaker::resource_restart_flag { 'haproxy-clone':
+ subscribe => Concat['/etc/haproxy/haproxy.cfg'],
+ }
+ }
+
+ if $step >= 2 and $enable_load_balancer {
+ if $pacemaker_master {
+ $haproxy_short_node_names = hiera('haproxy_short_node_names')
+ $haproxy_short_node_names.each |String $node_name| {
+ pacemaker::property { "haproxy-role-${node_name}":
+ property => 'haproxy-role',
+ value => true,
+ tries => $pcs_tries,
+ node => $node_name,
+ before => Pacemaker::Resource::Bundle['haproxy-bundle'],
+ }
+ }
+ $haproxy_location_rule = {
+ resource_discovery => 'exclusive',
+ score => 0,
+ expression => ['haproxy-role eq true'],
+ }
+ # FIXME: we should not have to access tripleo::haproxy class
+ # parameters here to configure pacemaker VIPs. The configuration
+ # of pacemaker VIPs could move into puppet-tripleo or we should
+ # make use of less specific hiera parameters here for the settings.
+ $haproxy_nodes = hiera('haproxy_short_node_names')
+ $haproxy_nodes_count = count($haproxy_nodes)
+
+ pacemaker::resource::bundle { 'haproxy-bundle':
+ image => $haproxy_docker_image,
+ replicas => $haproxy_nodes_count,
+ container_options => 'network=host',
+ options => '--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS',
+ run_command => '/bin/bash /usr/local/bin/kolla_start',
+ storage_maps => {
+ 'haproxy-cfg-files' => {
+ 'source-dir' => '/var/lib/kolla/config_files/haproxy.json',
+ 'target-dir' => '/var/lib/kolla/config_files/config.json',
+ 'options' => 'ro',
+ },
+ 'haproxy-cfg-data' => {
+ 'source-dir' => '/var/lib/config-data/haproxy/etc',
+ 'target-dir' => '/etc',
+ 'options' => 'ro',
+ },
+ 'haproxy-hosts' => {
+ 'source-dir' => '/etc/hosts',
+ 'target-dir' => '/etc/hosts',
+ 'options' => 'ro',
+ },
+ 'haproxy-localtime' => {
+ 'source-dir' => '/etc/localtime',
+ 'target-dir' => '/etc/localtime',
+ 'options' => 'ro',
+ },
+ 'haproxy-pki-extracted' => {
+ 'source-dir' => '/etc/pki/ca-trust/extracted',
+ 'target-dir' => '/etc/pki/ca-trust/extracted',
+ 'options' => 'ro',
+ },
+ 'haproxy-pki-ca-bundle-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'options' => 'ro',
+ },
+ 'haproxy-pki-ca-bundle-trust-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'options' => 'ro',
+ },
+ 'haproxy-pki-cert' => {
+ 'source-dir' => '/etc/pki/tls/cert.pem',
+ 'target-dir' => '/etc/pki/tls/cert.pem',
+ 'options' => 'ro',
+ },
+ 'haproxy-dev-log' => {
+ 'source-dir' => '/dev/log',
+ 'target-dir' => '/dev/log',
+ 'options' => 'rw',
+ },
+ },
+ }
+ $control_vip = hiera('controller_virtual_ip')
+ tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_control_vip':
+ vip_name => 'control',
+ ip_address => $control_vip,
+ location_rule => $haproxy_location_rule,
+ pcs_tries => $pcs_tries,
+ }
+
+ $public_vip = hiera('public_virtual_ip')
+ tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_public_vip':
+ ensure => $public_vip and $public_vip != $control_vip,
+ vip_name => 'public',
+ ip_address => $public_vip,
+ location_rule => $haproxy_location_rule,
+ pcs_tries => $pcs_tries,
+ }
+
+ $redis_vip = hiera('redis_vip')
+ tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_redis_vip':
+ ensure => $redis_vip and $redis_vip != $control_vip,
+ vip_name => 'redis',
+ ip_address => $redis_vip,
+ location_rule => $haproxy_location_rule,
+ pcs_tries => $pcs_tries,
+ }
+
+ $internal_api_vip = hiera('internal_api_virtual_ip')
+ tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_internal_api_vip':
+ ensure => $internal_api_vip and $internal_api_vip != $control_vip,
+ vip_name => 'internal_api',
+ ip_address => $internal_api_vip,
+ location_rule => $haproxy_location_rule,
+ pcs_tries => $pcs_tries,
+ }
+
+ $storage_vip = hiera('storage_virtual_ip')
+ tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_vip':
+ ensure => $storage_vip and $storage_vip != $control_vip,
+ vip_name => 'storage',
+ ip_address => $storage_vip,
+ location_rule => $haproxy_location_rule,
+ pcs_tries => $pcs_tries,
+ }
+
+ $storage_mgmt_vip = hiera('storage_mgmt_virtual_ip')
+ tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_mgmt_vip':
+ ensure => $storage_mgmt_vip and $storage_mgmt_vip != $control_vip,
+ vip_name => 'storage_mgmt',
+ ip_address => $storage_mgmt_vip,
+ location_rule => $haproxy_location_rule,
+ pcs_tries => $pcs_tries,
+ }
+ }
+ }
+
+}
diff --git a/manifests/profile/pacemaker/neutron/lbaas.pp b/manifests/profile/pacemaker/neutron/lbaas.pp
new file mode 100644
index 0000000..96712d4
--- /dev/null
+++ b/manifests/profile/pacemaker/neutron/lbaas.pp
@@ -0,0 +1,44 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# 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::pacemaker::neutron::lbaas
+#
+# Neutron LBaaS Agent Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
+#
+# [*pacemaker_master*]
+# (Optional) The hostname of the pacemaker master
+# Defaults to hiera('bootstrap_nodeid')
+#
+class tripleo::profile::pacemaker::neutron::lbaas (
+ $step = hiera('step'),
+ $pacemaker_master = hiera('bootstrap_nodeid'),
+) {
+
+ include ::neutron::params
+ include ::tripleo::profile::pacemaker::neutron
+ include ::tripleo::profile::base::neutron::lbaas
+
+ if $step >= 5 and downcase($::hostname) == $pacemaker_master {
+ pacemaker::resource::service { $::neutron::params::lbaasv2_agent_service:
+ clone_params => 'interleave=true',
+ }
+ }
+}
diff --git a/manifests/profile/pacemaker/rabbitmq.pp b/manifests/profile/pacemaker/rabbitmq.pp
index f4b679a..bf6a38d 100644
--- a/manifests/profile/pacemaker/rabbitmq.pp
+++ b/manifests/profile/pacemaker/rabbitmq.pp
@@ -30,7 +30,7 @@
# (Optional) The number of HA queues in to be configured in rabbitmq
# Defaults to hiera('rabbitmq::nr_ha_queues'), which is usually 0 meaning
# that the queues number will be CEIL(N/2) where N is the number of rabbitmq
-# nodes.
+# nodes. The special value of -1 represents the mode 'ha-mode: all'
#
# [*rabbit_nodes*]
# (Optional) The list of rabbitmq nodes names
@@ -90,12 +90,16 @@ class tripleo::profile::pacemaker::rabbitmq (
if $user_ha_queues == 0 {
$nr_rabbit_nodes = size($rabbit_nodes)
$nr_ha_queues = $nr_rabbit_nodes / 2 + ($nr_rabbit_nodes % 2)
+ $params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
+ } elsif $user_ha_queues == -1 {
+ $params = 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\''
} else {
$nr_ha_queues = $user_ha_queues
+ $params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
}
pacemaker::resource::ocf { 'rabbitmq':
ocf_agent_name => 'heartbeat:rabbitmq-cluster',
- resource_params => "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'",
+ resource_params => $params,
clone_params => 'ordered=true interleave=true',
meta_params => 'notify=true',
op_params => 'start timeout=200s stop timeout=200s',
diff --git a/manifests/profile/pacemaker/rabbitmq_bundle.pp b/manifests/profile/pacemaker/rabbitmq_bundle.pp
new file mode 100644
index 0000000..b05b0b1
--- /dev/null
+++ b/manifests/profile/pacemaker/rabbitmq_bundle.pp
@@ -0,0 +1,194 @@
+# Copyright 2017 Red Hat, Inc.
+#
+# 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::pacemaker::rabbitmq_bundle
+#
+# Containerized RabbitMQ Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*rabbitmq_docker_image*]
+# (Optional) The docker image to use for creating the pacemaker bundle
+# Defaults to hiera('tripleo::profile::pacemaker::rabbitmq_bundle::rabbitmq_docker_image', undef)
+#
+# [*rabbitmq_docker_control_port*]
+# (Optional) The bundle's pacemaker_remote control port on the host
+# Defaults to hiera('tripleo::profile::pacemaker::rabbitmq_bundle::control_port', '3121')
+#
+# [*bootstrap_node*]
+# (Optional) The hostname of the node responsible for bootstrapping tasks
+# Defaults to hiera('rabbitmq_short_bootstrap_node_name')
+#
+# [*erlang_cookie*]
+# (Optional) Content of erlang cookie.
+# Defaults to hiera('rabbitmq::erlang_cookie').
+#
+# [*user_ha_queues*]
+# (Optional) The number of HA queues in to be configured in rabbitmq
+# Defaults to hiera('rabbitmq::nr_ha_queues'), which is usually 0 meaning
+# that the queues number will be CEIL(N/2) where N is the number of rabbitmq
+# nodes.
+#
+# [*rabbit_nodes*]
+# (Optional) The list of rabbitmq nodes names
+# Defaults to hiera('rabbitmq_node_names')
+#
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
+#
+# [*pcs_tries*]
+# (Optional) The number of times pcs commands should be retried.
+# Defaults to hiera('pcs_tries', 20)
+#
+class tripleo::profile::pacemaker::rabbitmq_bundle (
+ $rabbitmq_docker_image = hiera('tripleo::profile::pacemaker::rabbitmq_bundle::rabbitmq_docker_image', undef),
+ $rabbitmq_docker_control_port = hiera('tripleo::profile::pacemaker::rabbitmq_bundle::control_port', '3121'),
+ $bootstrap_node = hiera('rabbitmq_short_bootstrap_node_name'),
+ $erlang_cookie = hiera('rabbitmq::erlang_cookie'),
+ $user_ha_queues = hiera('rabbitmq::nr_ha_queues', 0),
+ $rabbit_nodes = hiera('rabbitmq_node_names'),
+ $pcs_tries = hiera('pcs_tries', 20),
+ $step = hiera('step'),
+) {
+ if $::hostname == downcase($bootstrap_node) {
+ $pacemaker_master = true
+ } else {
+ $pacemaker_master = false
+ }
+
+ include ::tripleo::profile::base::rabbitmq
+
+ file { '/var/lib/rabbitmq/.erlang.cookie':
+ ensure => file,
+ owner => 'rabbitmq',
+ group => 'rabbitmq',
+ mode => '0400',
+ content => $erlang_cookie,
+ replace => true,
+ require => Class['::rabbitmq'],
+ }
+
+ if $step >= 1 and $pacemaker_master and hiera('stack_action') == 'UPDATE' {
+ tripleo::pacemaker::resource_restart_flag { 'rabbitmq-clone':
+ subscribe => Class['rabbitmq::service'],
+ }
+ }
+
+
+ if $step >= 2 {
+ if $pacemaker_master {
+ $rabbitmq_short_node_names = hiera('rabbitmq_short_node_names')
+ $rabbitmq_nodes_count = count($rabbitmq_short_node_names)
+ $rabbitmq_short_node_names.each |String $node_name| {
+ pacemaker::property { "rabbitmq-role-${node_name}":
+ property => 'rabbitmq-role',
+ value => true,
+ tries => $pcs_tries,
+ node => $node_name,
+ before => Pacemaker::Resource::Bundle['rabbitmq-bundle'],
+ }
+ }
+
+ pacemaker::resource::bundle { 'rabbitmq-bundle':
+ image => $rabbitmq_docker_image,
+ replicas => $rabbitmq_nodes_count,
+ container_options => 'network=host',
+ options => '--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS',
+ run_command => '/bin/bash /usr/local/bin/kolla_start',
+ network => "control-port=${rabbitmq_docker_control_port}",
+ storage_maps => {
+ 'rabbitmq-cfg-files' => {
+ 'source-dir' => '/var/lib/kolla/config_files/rabbitmq.json',
+ 'target-dir' => '/var/lib/kolla/config_files/config.json',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-cfg-data' => {
+ 'source-dir' => '/var/lib/config-data/rabbitmq/etc/rabbitmq',
+ 'target-dir' => '/etc/rabbitmq',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-hosts' => {
+ 'source-dir' => '/etc/hosts',
+ 'target-dir' => '/etc/hosts',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-localtime' => {
+ 'source-dir' => '/etc/localtime',
+ 'target-dir' => '/etc/localtime',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-lib' => {
+ 'source-dir' => '/var/lib/rabbitmq',
+ 'target-dir' => '/var/lib/rabbitmq',
+ 'options' => 'rw',
+ },
+ 'rabbitmq-pki-extracted' => {
+ 'source-dir' => '/etc/pki/ca-trust/extracted',
+ 'target-dir' => '/etc/pki/ca-trust/extracted',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-pki-ca-bundle-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.crt',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-pki-ca-bundle-trust-crt' => {
+ 'source-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'target-dir' => '/etc/pki/tls/certs/ca-bundle.trust.crt',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-pki-cert' => {
+ 'source-dir' => '/etc/pki/tls/cert.pem',
+ 'target-dir' => '/etc/pki/tls/cert.pem',
+ 'options' => 'ro',
+ },
+ 'rabbitmq-dev-log' => {
+ 'source-dir' => '/dev/log',
+ 'target-dir' => '/dev/log',
+ 'options' => 'rw',
+ },
+ },
+ }
+
+ # The default nr of ha queues is ceiling(N/2)
+ if $user_ha_queues == 0 {
+ $nr_rabbit_nodes = size($rabbit_nodes)
+ $nr_ha_queues = $nr_rabbit_nodes / 2 + ($nr_rabbit_nodes % 2)
+ $params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
+ } elsif $user_ha_queues == -1 {
+ $params = 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\''
+ } else {
+ $nr_ha_queues = $user_ha_queues
+ $params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
+ }
+ pacemaker::resource::ocf { 'rabbitmq':
+ ocf_agent_name => 'heartbeat:rabbitmq-cluster',
+ resource_params => $params,
+ meta_params => 'notify=true',
+ op_params => 'start timeout=200s stop timeout=200s',
+ tries => $pcs_tries,
+ location_rule => {
+ resource_discovery => 'exclusive',
+ score => 0,
+ expression => ['rabbitmq-role eq true'],
+ },
+ bundle => 'rabbitmq-bundle',
+ require => [Class['::rabbitmq'],
+ Pacemaker::Resource::Bundle['rabbitmq-bundle']],
+ }
+ }
+ }
+}