aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/pacemaker
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/profile/pacemaker')
-rw-r--r--manifests/profile/pacemaker/cinder/backup_bundle.pp146
-rw-r--r--manifests/profile/pacemaker/cinder/volume_bundle.pp141
-rw-r--r--manifests/profile/pacemaker/clustercheck.pp65
-rw-r--r--manifests/profile/pacemaker/database/mysql.pp9
-rw-r--r--manifests/profile/pacemaker/database/mysql_bundle.pp302
-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/ovn_northd.pp121
-rw-r--r--manifests/profile/pacemaker/rabbitmq_bundle.pp194
9 files changed, 1352 insertions, 0 deletions
diff --git a/manifests/profile/pacemaker/cinder/backup_bundle.pp b/manifests/profile/pacemaker/cinder/backup_bundle.pp
new file mode 100644
index 0000000..cd06986
--- /dev/null
+++ b/manifests/profile/pacemaker/cinder/backup_bundle.pp
@@ -0,0 +1,146 @@
+# 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::cinder::backup_bundle
+#
+# Containerized Redis Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*cinder_backup_docker_image*]
+# (Optional) The docker image to use for creating the pacemaker bundle
+# Defaults to hiera('tripleo::profile::pacemaker::cinder::backup_bundle::cinder_docker_image', undef)
+#
+# [*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::cinder::backup_bundle (
+ $bootstrap_node = hiera('cinder_backup_short_bootstrap_node_name'),
+ $cinder_backup_docker_image = hiera('tripleo::profile::pacemaker::cinder::backup_bundle::cinder_backup_docker_image', undef),
+ $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::cinder::backup
+
+ if $step >= 2 and $pacemaker_master {
+ $cinder_backup_short_node_names = hiera('cinder_backup_short_node_names')
+ $cinder_backup_short_node_names.each |String $node_name| {
+ pacemaker::property { "cinder-backup-role-${node_name}":
+ property => 'cinder-backup-role',
+ value => true,
+ tries => $pcs_tries,
+ node => $node_name,
+ before => Pacemaker::Resource::Bundle[$::cinder::params::backup_service],
+ }
+ }
+ }
+
+ if $step >= 5 {
+ if $pacemaker_master {
+ $cinder_backup_nodes_count = count(hiera('cinder_backup_short_node_names', []))
+
+ pacemaker::resource::bundle { $::cinder::params::backup_service :
+ image => $cinder_backup_docker_image,
+ replicas => 1,
+ location_rule => {
+ resource_discovery => 'exclusive',
+ score => 0,
+ expression => ['cinder-backup-role eq true'],
+ },
+ container_options => 'network=host',
+ options => '--ipc=host --privileged=true --user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS',
+ run_command => '/bin/bash /usr/local/bin/kolla_start',
+ storage_maps => {
+ 'cinder-backup-cfg-files' => {
+ 'source-dir' => '/var/lib/kolla/config_files/cinder_backup.json',
+ 'target-dir' => '/var/lib/kolla/config_files/config.json',
+ 'options' => 'ro',
+ },
+ 'cinder-backup-cfg-data' => {
+ 'source-dir' => '/var/lib/config-data/cinder/etc/cinder',
+ 'target-dir' => '/etc/cinder',
+ 'options' => 'ro',
+ },
+ 'cinder-backup-cfg-ceph' => {
+ 'source-dir' => '/var/lib/config-data/cinder/etc/ceph',
+ 'target-dir' => '/etc/ceph',
+ 'options' => 'ro',
+ },
+ 'cinder-backup-hosts' => {
+ 'source-dir' => '/etc/hosts',
+ 'target-dir' => '/etc/hosts',
+ 'options' => 'ro',
+ },
+ 'cinder-backup-localtime' => {
+ 'source-dir' => '/etc/localtime',
+ 'target-dir' => '/etc/localtime',
+ 'options' => 'ro',
+ },
+ 'cinder-backup-dev' => {
+ 'source-dir' => '/dev',
+ 'target-dir' => '/dev',
+ 'options' => 'rw',
+ },
+ 'cinder-backup-run' => {
+ 'source-dir' => '/run',
+ 'target-dir' => '/run',
+ 'options' => 'rw',
+ },
+ 'cinder-backup-sys' => {
+ 'source-dir' => '/sys',
+ 'target-dir' => '/sys',
+ 'options' => 'rw',
+ },
+ 'cinder-backup-lib-modules' => {
+ 'source-dir' => '/lib/modules',
+ 'target-dir' => '/lib/modules',
+ 'options' => 'ro',
+ },
+ 'cinder-backup-iscsi' => {
+ 'source-dir' => '/etc/iscsi',
+ 'target-dir' => '/etc/iscsi',
+ 'options' => 'rw',
+ },
+ 'cinder-backup-var-lib-cinder' => {
+ 'source-dir' => '/var/lib/cinder',
+ 'target-dir' => '/var/lib/cinder',
+ 'options' => 'rw',
+ },
+ 'cinder-backup-var-log' => {
+ 'source-dir' => '/var/log/containers/cinder',
+ 'target-dir' => '/var/log/cinder',
+ 'options' => 'rw',
+ },
+ },
+ }
+ }
+ }
+}
diff --git a/manifests/profile/pacemaker/cinder/volume_bundle.pp b/manifests/profile/pacemaker/cinder/volume_bundle.pp
new file mode 100644
index 0000000..f0858c9
--- /dev/null
+++ b/manifests/profile/pacemaker/cinder/volume_bundle.pp
@@ -0,0 +1,141 @@
+# 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::cinder::volume_bundle
+#
+# Containerized Redis Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*cinder_volume_docker_image*]
+# (Optional) The docker image to use for creating the pacemaker bundle
+# Defaults to hiera('tripleo::profile::pacemaker::cinder::volume_bundle::cinder_docker_image', undef)
+#
+# [*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::cinder::volume_bundle (
+ $bootstrap_node = hiera('cinder_volume_short_bootstrap_node_name'),
+ $cinder_volume_docker_image = hiera('tripleo::profile::pacemaker::cinder::volume_bundle::cinder_volume_docker_image', undef),
+ $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::cinder::volume
+
+ if $step >= 2 and $pacemaker_master {
+ $cinder_volume_short_node_names = hiera('cinder_volume_short_node_names')
+ $cinder_volume_short_node_names.each |String $node_name| {
+ pacemaker::property { "cinder-volume-role-${node_name}":
+ property => 'cinder-volume-role',
+ value => true,
+ tries => $pcs_tries,
+ node => $node_name,
+ before => Pacemaker::Resource::Bundle[$::cinder::params::volume_service],
+ }
+ }
+ }
+
+ if $step >= 5 {
+ if $pacemaker_master {
+ $cinder_volume_nodes_count = count(hiera('cinder_volume_short_node_names', []))
+
+ pacemaker::resource::bundle { $::cinder::params::volume_service:
+ image => $cinder_volume_docker_image,
+ replicas => 1,
+ location_rule => {
+ resource_discovery => 'exclusive',
+ score => 0,
+ expression => ['cinder-volume-role eq true'],
+ },
+ container_options => 'network=host',
+ options => '--ipc=host --privileged=true --user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS',
+ run_command => '/bin/bash /usr/local/bin/kolla_start',
+ storage_maps => {
+ 'cinder-volume-cfg-files' => {
+ 'source-dir' => '/var/lib/kolla/config_files/cinder_volume.json',
+ 'target-dir' => '/var/lib/kolla/config_files/config.json',
+ 'options' => 'ro',
+ },
+ 'cinder-volume-cfg-data' => {
+ 'source-dir' => '/var/lib/config-data/cinder/etc/cinder',
+ 'target-dir' => '/etc/cinder',
+ 'options' => 'ro',
+ },
+ 'cinder-volume-hosts' => {
+ 'source-dir' => '/etc/hosts',
+ 'target-dir' => '/etc/hosts',
+ 'options' => 'ro',
+ },
+ 'cinder-volume-localtime' => {
+ 'source-dir' => '/etc/localtime',
+ 'target-dir' => '/etc/localtime',
+ 'options' => 'ro',
+ },
+ 'cinder-volume-dev' => {
+ 'source-dir' => '/dev',
+ 'target-dir' => '/dev',
+ 'options' => 'rw',
+ },
+ 'cinder-volume-run' => {
+ 'source-dir' => '/run',
+ 'target-dir' => '/run',
+ 'options' => 'rw',
+ },
+ 'cinder-volume-sys' => {
+ 'source-dir' => '/sys',
+ 'target-dir' => '/sys',
+ 'options' => 'rw',
+ },
+ 'cinder-volume-lib-modules' => {
+ 'source-dir' => '/lib/modules',
+ 'target-dir' => '/lib/modules',
+ 'options' => 'ro',
+ },
+ 'cinder-volume-iscsi' => {
+ 'source-dir' => '/etc/iscsi',
+ 'target-dir' => '/etc/iscsi',
+ 'options' => 'rw',
+ },
+ 'cinder-volume-var-lib-cinder' => {
+ 'source-dir' => '/var/lib/cinder',
+ 'target-dir' => '/var/lib/cinder',
+ 'options' => 'rw',
+ },
+ 'cinder-volume-var-log' => {
+ 'source-dir' => '/var/log/containers/cinder',
+ 'target-dir' => '/var/log/cinder',
+ 'options' => 'rw',
+ },
+ },
+ }
+ }
+ }
+}
diff --git a/manifests/profile/pacemaker/clustercheck.pp b/manifests/profile/pacemaker/clustercheck.pp
new file mode 100644
index 0000000..fad30da
--- /dev/null
+++ b/manifests/profile/pacemaker/clustercheck.pp
@@ -0,0 +1,65 @@
+# 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::clustercheck
+#
+# Clustercheck, galera health check profile for tripleo
+#
+# === Parameters
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
+#
+# [*bind_address*]
+# (Optional) The address that the local mysql instance should bind to.
+# Defaults to hiera('mysql_bind_host')
+#
+# [*clustercheck_password*]
+# (Optional) The password for the clustercheck user.
+# Defaults to hiera('mysql::server::root_password')
+#
+#
+class tripleo::profile::pacemaker::clustercheck (
+ $step = hiera('step'),
+ $clustercheck_password = hiera('mysql::server::root_password'),
+ $bind_address = hiera('mysql_bind_host'),
+) {
+
+ if $step >= 1 {
+ file { '/etc/sysconfig/clustercheck' :
+ ensure => file,
+ mode => '0600',
+ owner => 'mysql',
+ group => 'mysql',
+ content => "MYSQL_USERNAME=root\n
+MYSQL_PASSWORD='${clustercheck_password}'\n
+MYSQL_HOST=localhost\n",
+ }
+
+ # the clustercheck service is run via xinet in the container
+ xinetd::service { 'galera-monitor' :
+ bind => $bind_address,
+ port => '9200',
+ server => '/usr/bin/clustercheck',
+ per_source => 'UNLIMITED',
+ log_on_success => '',
+ log_on_failure => 'HOST',
+ flags => 'REUSE',
+ service_type => 'UNLISTED',
+ user => 'mysql',
+ group => 'mysql',
+ }
+ }
+}
diff --git a/manifests/profile/pacemaker/database/mysql.pp b/manifests/profile/pacemaker/database/mysql.pp
index 031e80c..476a1e5 100644
--- a/manifests/profile/pacemaker/database/mysql.pp
+++ b/manifests/profile/pacemaker/database/mysql.pp
@@ -100,6 +100,15 @@ class tripleo::profile::pacemaker::database::mysql (
}
}
+ # since we are configuring rsync for wsrep_sst_method, we ought to make sure
+ # it's installed. We only includ this at step 2 since puppet-rsync may be
+ # included later and also adds the package resource.
+ if $step == 2 {
+ if ! defined(Package['rsync']) {
+ package {'rsync':}
+ }
+ }
+
# 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
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_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/ovn_northd.pp b/manifests/profile/pacemaker/ovn_northd.pp
new file mode 100644
index 0000000..af946af
--- /dev/null
+++ b/manifests/profile/pacemaker/ovn_northd.pp
@@ -0,0 +1,121 @@
+# 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::neutron::plugins::ml2::ovn
+#
+# Neutron ML2 driver Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*pacemaker_master*]
+# (Optional) The hostname of the pacemaker master
+# Defaults to hiera('ovn_dbs_short_bootstrap_node_name')
+#
+# [*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)
+#
+# [*ovn_dbs_vip*]
+# (Optional) The OVN database virtual IP to be managed by the pacemaker.
+# Defaults to hiera('ovn_dbs_vip')
+#
+# [*nb_db_port*]
+# The TCP port in which the OVN Northbound DB listens to.
+# Defaults to 6641
+#
+# [*sb_db_port*]
+# The TCP port in which the OVN Southbound DB listens to.
+# Defaults to 6642
+#
+
+class tripleo::profile::pacemaker::ovn_northd (
+ $pacemaker_master = hiera('ovn_dbs_short_bootstrap_node_name'),
+ $step = hiera('step'),
+ $pcs_tries = hiera('pcs_tries', 20),
+ $ovn_dbs_vip = hiera('ovn_dbs_vip'),
+ $nb_db_port = 6641,
+ $sb_db_port = 6642
+) {
+
+ if $step >= 2 {
+ pacemaker::property { 'ovndb-role-node-property':
+ property => 'ovndb-role',
+ value => true,
+ tries => $pcs_tries,
+ node => $::hostname,
+ }
+ }
+
+ if $step >= 3 and downcase($::hostname) == $pacemaker_master {
+ $ovndb_servers_resource_name = 'ovndb_servers'
+ $ovndb_servers_ocf_name = 'ovn:ovndb-servers'
+ $ovndb_vip_resource_name = "ip-${ovn_dbs_vip}"
+
+ if is_ipv6_address($ovn_dbs_vip) {
+ $netmask = '128'
+ $nic = interface_for_ip($ovn_dbs_vip)
+ } else {
+ $netmask = '32'
+ $nic = ''
+ }
+
+ pacemaker::resource::ip { "${ovndb_vip_resource_name}":
+ ip_address => $ovn_dbs_vip,
+ cidr_netmask => $netmask,
+ nic => $nic,
+ tries => $pcs_tries,
+ }
+
+ pacemaker::resource::ocf { "${ovndb_servers_resource_name}":
+ ocf_agent_name => "${ovndb_servers_ocf_name}",
+ master_params => '',
+ op_params => 'start timeout=200s stop timeout=200s',
+ resource_params => "master_ip=${ovn_dbs_vip} nb_master_port=${nb_db_port} sb_master_port=${sb_db_port} manage_northd=yes",
+ tries => $pcs_tries,
+ location_rule => {
+ resource_discovery => 'exclusive',
+ score => 0,
+ expression => ['ovndb-role eq true'],
+ },
+ meta_params => 'notify=true'
+ }
+
+ pacemaker::constraint::order { "${ovndb_vip_resource_name}-then-${ovndb_servers_resource_name}":
+ first_resource => "${ovndb_vip_resource_name}",
+ second_resource => "${ovndb_servers_resource_name}-master",
+ first_action => 'start',
+ second_action => 'start',
+ constraint_params => 'kind=Mandatory',
+ tries => $pcs_tries,
+ }
+
+ pacemaker::constraint::colocation { "${ovndb_vip_resource_name}-with-${ovndb_servers_resource_name}":
+ source => "${ovndb_vip_resource_name}",
+ target => "${ovndb_servers_resource_name}-master",
+ master_slave => true,
+ score => 'INFINITY',
+ tries => $pcs_tries,
+ }
+
+ Pacemaker::Resource::Ip["${ovndb_vip_resource_name}"] ->
+ Pacemaker::Resource::Ocf["${ovndb_servers_resource_name}"] ->
+ Pacemaker::Constraint::Order["${ovndb_vip_resource_name}-then-${ovndb_servers_resource_name}"] ->
+ Pacemaker::Constraint::Colocation["${ovndb_vip_resource_name}-with-${ovndb_servers_resource_name}"]
+ }
+}
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']],
+ }
+ }
+ }
+}