diff options
22 files changed, 421 insertions, 158 deletions
diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index 664590b..2926e49 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -175,10 +175,6 @@ # (optional) Enable or not Glance registry binding # Defaults to false # -# [*nova_ec2*] -# (optional) Enable or not Nova EC2 API binding -# Defaults to false -# # [*nova_osapi*] # (optional) Enable or not Nova API binding # Defaults to false @@ -269,7 +265,7 @@ # 'heat_api_port' (Defaults to 8004) # 'heat_api_ssl_port' (Defaults to 13004) # 'heat_cfn_port' (Defaults to 8000) -# 'heat_cfn_ssl_port' (Defaults to 13800) +# 'heat_cfn_ssl_port' (Defaults to 13005) # 'heat_cw_port' (Defaults to 8003) # 'heat_cw_ssl_port' (Defaults to 13003) # 'ironic_api_port' (Defaults to 6385) @@ -284,8 +280,6 @@ # 'neutron_api_ssl_port' (Defaults to 13696) # 'nova_api_port' (Defaults to 8774) # 'nova_api_ssl_port' (Defaults to 13774) -# 'nova_ec2_port' (Defaults to 8773) -# 'nova_ec2_ssl_port' (Defaults to 13773) # 'nova_metadata_port' (Defaults to 8775) # 'nova_novnc_port' (Defaults to 6080) # 'nova_novnc_ssl_port' (Defaults to 13080) @@ -332,7 +326,6 @@ class tripleo::loadbalancer ( $manila = false, $glance_api = false, $glance_registry = false, - $nova_ec2 = false, $nova_osapi = false, $nova_metadata = false, $nova_novncproxy = false, @@ -368,7 +361,7 @@ class tripleo::loadbalancer ( heat_api_port => 8004, heat_api_ssl_port => 13004, heat_cfn_port => 8000, - heat_cfn_ssl_port => 13800, + heat_cfn_ssl_port => 13005, heat_cw_port => 8003, heat_cw_ssl_port => 13003, ironic_api_port => 6385, @@ -383,8 +376,6 @@ class tripleo::loadbalancer ( neutron_api_ssl_port => 13696, nova_api_port => 8774, nova_api_ssl_port => 13774, - nova_ec2_port => 8773, - nova_ec2_ssl_port => 13773, nova_metadata_port => 8775, nova_novnc_port => 6080, nova_novnc_ssl_port => 13080, @@ -717,17 +708,6 @@ class tripleo::loadbalancer ( } $nova_api_vip = hiera('nova_api_vip', $controller_virtual_ip) - if $nova_ec2 { - ::tripleo::loadbalancer::endpoint { 'nova_ec2': - public_virtual_ip => $public_virtual_ip, - internal_ip => $nova_api_vip, - service_port => $ports[nova_ec2_port], - ip_addresses => hiera('nova_api_node_ips', $controller_hosts_real), - server_names => $controller_hosts_names_real, - public_ssl_port => $ports[nova_ec2_ssl_port], - } - } - if $nova_osapi { ::tripleo::loadbalancer::endpoint { 'nova_osapi': public_virtual_ip => $public_virtual_ip, diff --git a/manifests/profile/base/glance/api.pp b/manifests/profile/base/glance/api.pp index 22b4dc9..ad59a38 100644 --- a/manifests/profile/base/glance/api.pp +++ b/manifests/profile/base/glance/api.pp @@ -18,14 +18,6 @@ # # === Parameters # -# [*manage_service*] -# (Optional) Whether to manage the glance service -# Defaults to undef -# -# [*enabled*] -# (Optional) Whether to enable the glance service -# Defaults to undef -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -36,8 +28,6 @@ # Defaults to downcase(hiera('glance_backend', 'swift')) # class tripleo::profile::base::glance::api ( - $manage_service = undef, - $enabled = undef, $step = hiera('step'), $glance_backend = downcase(hiera('glance_backend', 'swift')), ) { @@ -57,12 +47,9 @@ class tripleo::profile::base::glance::api ( include ::glance::config class { '::glance::api': known_stores => $glance_store, - manage_service => $manage_service, - enabled => $enabled, } include ::glance::notify::rabbitmq include join(['::glance::backend::', $glance_backend]) } } - diff --git a/manifests/profile/base/glance/registry.pp b/manifests/profile/base/glance/registry.pp index b77b356..774f646 100644 --- a/manifests/profile/base/glance/registry.pp +++ b/manifests/profile/base/glance/registry.pp @@ -22,14 +22,6 @@ # (Optional) Whether to run db sync # Defaults to true # -# [*manage_service*] -# (Optional) Whether to manage the glance service -# Defaults to undef -# -# [*enabled*] -# (Optional) Whether to enable the glance service -# Defaults to undef -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -41,8 +33,6 @@ # class tripleo::profile::base::glance::registry ( $sync_db = true, - $manage_service = undef, - $enabled = undef, $step = hiera('step'), $glance_backend = downcase(hiera('glance_backend', 'swift')), ) { @@ -57,12 +47,9 @@ class tripleo::profile::base::glance::registry ( include ::glance::config class { '::glance::registry' : sync_db => $sync_db, - manage_service => $manage_service, - enabled => $enabled, } include ::glance::notify::rabbitmq include join(['::glance::backend::', $glance_backend]) } } - diff --git a/manifests/profile/base/keystone.pp b/manifests/profile/base/keystone.pp index 2f7a27a..a5060b8 100644 --- a/manifests/profile/base/keystone.pp +++ b/manifests/profile/base/keystone.pp @@ -22,14 +22,6 @@ # (Optional) Whether to run db sync # Defaults to true # -# [*manage_service*] -# (Optional) Whether to manage the keystone service -# Defaults to undef -# -# [*enabled*] -# (Optional) Whether to enable the keystone service -# Defaults to undef -# # [*bootstrap_master*] # (Optional) The hostname of the node responsible for bootstrapping # Defaults to hiera('bootstrap_nodeid') @@ -53,8 +45,6 @@ # class tripleo::profile::base::keystone ( $sync_db = true, - $manage_service = undef, - $enabled = undef, $bootstrap_master = undef, $manage_roles = true, $manage_endpoint = true, @@ -69,8 +59,6 @@ class tripleo::profile::base::keystone ( if $step >= 4 or ( $step >= 3 and $sync_db ) { class { '::keystone': sync_db => $sync_db, - manage_service => $manage_service, - enabled => $enabled, enable_bootstrap => $bootstrap_master, } @@ -96,21 +84,21 @@ class tripleo::profile::base::keystone ( content => hiera('keystone_signing_certificate'), owner => 'keystone', group => 'keystone', - notify => Service['keystone'], + notify => Service[$::apache::params::service_name], require => File['/etc/keystone/ssl/certs'], } file { '/etc/keystone/ssl/private/signing_key.pem': content => hiera('keystone_signing_key'), owner => 'keystone', group => 'keystone', - notify => Service['keystone'], + notify => Service[$::apache::params::service_name], require => File['/etc/keystone/ssl/private'], } file { '/etc/keystone/ssl/certs/ca.pem': content => hiera('keystone_ca_certificate'), owner => 'keystone', group => 'keystone', - notify => Service['keystone'], + notify => Service[$::apache::params::service_name], require => File['/etc/keystone/ssl/certs'], } } diff --git a/manifests/profile/base/loadbalancer.pp b/manifests/profile/base/loadbalancer.pp new file mode 100644 index 0000000..2a961c4 --- /dev/null +++ b/manifests/profile/base/loadbalancer.pp @@ -0,0 +1,55 @@ +# 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::base::loadbalancer +# +# Loadbalancer profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*enable_load_balancer*] +# (Optional) Whether or not loadbalancer is enabled. +# Defaults to hiera('enable_load_balancer', true). +# +# [*controller_node_ips*] +# (Optional) List of IPs for controller nodes. +# Defaults to split(hiera('controller_node_ips'), ',')). +# +# [*controller_node_names*] +# (Optional) List of hostnames for controller nodes. +# Defaults to split(downcase(hiera('controller_node_names')), ','). +# +class tripleo::profile::base::loadbalancer ( + $enable_load_balancer = hiera('enable_load_balancer', true), + $controller_node_ips = split(hiera('controller_node_ips'), ','), + $controller_node_names = split(downcase(hiera('controller_node_names')), ','), + $step = hiera('step'), +) { + + if $step >= 1 { + if $enable_load_balancer { + class { '::tripleo::loadbalancer': + controller_hosts => $controller_node_ips, + controller_hosts_names => $controller_node_names, + } + } + } + +} + diff --git a/manifests/profile/base/memcached.pp b/manifests/profile/base/memcached.pp new file mode 100644 index 0000000..54d12c8 --- /dev/null +++ b/manifests/profile/base/memcached.pp @@ -0,0 +1,34 @@ +# 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::base::memcached +# +# Memcached profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# +class tripleo::profile::base::memcached ( + $step = hiera('step'), +) { + + if $step >= 1 { + include ::memcached + } +} diff --git a/manifests/profile/base/neutron/dhcp.pp b/manifests/profile/base/neutron/dhcp.pp index 4d5bb28..180fd37 100644 --- a/manifests/profile/base/neutron/dhcp.pp +++ b/manifests/profile/base/neutron/dhcp.pp @@ -22,14 +22,6 @@ # (Optional) # Defaults to hiera('neutron_dnsmasq_options') # -# [*enabled*] -# (Optional) Whether to enable the Neutron DHCP Agent service -# Defaults to undef -# -# [*manage_service*] -# (Optional) Whether to manage the Neutron DHCP Agent service -# Defaults to undef -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -37,16 +29,11 @@ # class tripleo::profile::base::neutron::dhcp ( $neutron_dnsmasq_options = hiera('neutron_dnsmasq_options', ''), - $enabled = undef, - $manage_service = undef, $step = hiera('step'), ) { if $step >= 4 { include ::tripleo::profile::base::neutron - class { '::neutron::agents::dhcp': - manage_service => $manage_service, - enabled => $enabled - } + include ::neutron::agents::dhcp file { '/etc/neutron/dnsmasq-neutron.conf': content => $neutron_dnsmasq_options, diff --git a/manifests/profile/base/neutron/l3.pp b/manifests/profile/base/neutron/l3.pp index f96833a..2b57555 100644 --- a/manifests/profile/base/neutron/l3.pp +++ b/manifests/profile/base/neutron/l3.pp @@ -22,30 +22,17 @@ # (Optional) Whether to set ovs_use_veth (for older kernel support) # Defaults to hiera('neutron_ovs_use_veth', false) # -# [*enabled*] -# (Optional) Whether to enable the Neutron L3 Agent service -# Defaults to undef -# -# [*manage_service*] -# (Optional) Whether to manage the Neutron L3 Agent service -# Defaults to undef -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. # Defaults to hiera('step') # class tripleo::profile::base::neutron::l3 ( - $enabled = undef, - $manage_service = undef, $step = hiera('step'), ) { if $step >= 4 { include ::tripleo::profile::base::neutron - class { '::neutron::agents::l3': - manage_service => $manage_service, - enabled => $enabled - } + include ::neutron::agents::l3 Service<| title == 'neutron-server' |> -> Service <| title == 'neutron-l3' |> } diff --git a/manifests/profile/base/neutron/metadata.pp b/manifests/profile/base/neutron/metadata.pp index bdad751..d7b4c99 100644 --- a/manifests/profile/base/neutron/metadata.pp +++ b/manifests/profile/base/neutron/metadata.pp @@ -18,30 +18,17 @@ # # === Parameters # -# [*enabled*] -# (Optional) Whether to enable the Neutron Metadata Agent service -# Defaults to undef -# -# [*manage_service*] -# (Optional) Whether to manage the Neutron Metadata Agent service -# Defaults to undef -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. # Defaults to hiera('step') # class tripleo::profile::base::neutron::metadata ( - $enabled = undef, - $manage_service = undef, $step = hiera('step'), ) { if $step >= 4 { include ::tripleo::profile::base::neutron - class { '::neutron::agents::metadata': - manage_service => $manage_service, - enabled => $enabled - } + include ::neutron::agents::metadata Service<| title == 'neutron-server' |> -> Service<| title == 'neutron-metadata' |> } diff --git a/manifests/profile/base/neutron/ovs.pp b/manifests/profile/base/neutron/ovs.pp index 783952b..f801511 100644 --- a/manifests/profile/base/neutron/ovs.pp +++ b/manifests/profile/base/neutron/ovs.pp @@ -18,32 +18,19 @@ # # === Parameters # -# [*manage_service*] -# (Optional) Whether to manage the Neutron OVS Agent service -# Defaults to undef -# -# [*enabled*] -# (Optional) Whether to enable the Neutron OVS Agent service -# Defaults to undef -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. # Defaults to hiera('step') # class tripleo::profile::base::neutron::ovs( - $manage_service = undef, - $enabled = undef, $step = hiera('step'), ) { include ::tripleo::profile::base::neutron if $step >= 4 { - class { '::neutron::agents::ml2::ovs': - manage_service => $manage_service, - enabled => $enabled - } + include ::neutron::agents::ml2::ovs # Optional since manage_service may be false and neutron server may not be colocated. Service<| title == 'neutron-server' |> -> Service<| title == 'neutron-ovs-agent-service' |> diff --git a/manifests/profile/base/neutron/server.pp b/manifests/profile/base/neutron/server.pp index 20127ed..14af56e 100644 --- a/manifests/profile/base/neutron/server.pp +++ b/manifests/profile/base/neutron/server.pp @@ -22,14 +22,6 @@ # (Optional) Whether to run Neutron DB sync operations # Defaults to undef # -# [*manage_service*] -# (Optional) Whether to manage the Neutron Server service -# Defaults to undef -# -# [*enabled*] -# (Optional) Whether to enable the Neutron Server service -# Defaults to undef -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -37,8 +29,6 @@ # class tripleo::profile::base::neutron::server ( $sync_db = true, - $manage_service = undef, - $enabled = undef, $step = hiera('step'), ) { @@ -53,8 +43,6 @@ class tripleo::profile::base::neutron::server ( class { '::neutron::server': sync_db => $sync_db, - manage_service => $manage_service, - enabled => $enabled } } } diff --git a/manifests/profile/base/rabbitmq.pp b/manifests/profile/base/rabbitmq.pp new file mode 100644 index 0000000..e67d71a --- /dev/null +++ b/manifests/profile/base/rabbitmq.pp @@ -0,0 +1,91 @@ +# 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::base::rabbitmq +# +# RabbitMQ profile for tripleo +# +# === Parameters +# +# [*nodes*] +# (Optional) Array of host(s) for RabbitMQ nodes. +# Defaults to hiera('rabbit_node_ips', []). +# +# [*ipv6*] +# (Optional) Whether to deploy RabbitMQ on IPv6 network. +# Defaults to str2bool(hiera('rabbit_ipv6', false)). +# +# [*environment*] +# (Optional) RabbitMQ environment. +# Defaults to hiera('rabbitmq_environment'). +# +# [*kernel_variables*] +# (Optional) RabbitMQ environment. +# Defaults to hiera('rabbitmq_environment'). +# +# [*config_variables*] +# (Optional) RabbitMQ environment. +# Defaults to hiera('rabbitmq_config_variables'). +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::base::rabbitmq ( + $nodes = hiera('rabbit_node_ips', []), + $ipv6 = str2bool(hiera('rabbit_ipv6', false)), + $environment = hiera('rabbitmq_environment'), + $kernel_variables = hiera('rabbitmq_kernel_variables'), + $config_variables = hiera('rabbitmq_config_variables'), + $step = hiera('step'), +) { + + # IPv6 environment, necessary for RabbitMQ. + if $ipv6 { + $rabbit_env = merge($environment, { + 'RABBITMQ_SERVER_START_ARGS' => '"-proto_dist inet6_tcp"' + }) + } else { + $rabbit_env = $environment + } + + $manage_service = hiera('rabbitmq::service_manage', true) + if $step >= 1 { + # Specific configuration for multi-nodes or when running with Pacemaker. + if count($nodes) > 1 or ! $manage_service { + class { '::rabbitmq': + config_cluster => $manage_service, + cluster_nodes => $nodes, + tcp_keepalive => false, + config_kernel_variables => $kernel_variables, + config_variables => $config_variables, + environment_variables => $rabbit_env, + } + # when running multi-nodes without Pacemaker + if $manage_service { + rabbitmq_policy { 'ha-all@/': + pattern => '^(?!amq\.).*', + definition => { + 'ha-mode' => 'all', + }, + } + } + } else { + # Standard configuration + include ::rabbitmq + } + } + +} diff --git a/manifests/profile/pacemaker/glance.pp b/manifests/profile/pacemaker/glance.pp index 4dca67e..10f4f03 100644 --- a/manifests/profile/pacemaker/glance.pp +++ b/manifests/profile/pacemaker/glance.pp @@ -75,14 +75,9 @@ class tripleo::profile::pacemaker::glance ( $pacemaker_master = false } - class { '::tripleo::profile::base::glance::api': - manage_service => false, - enabled => false, - } + include ::tripleo::profile::base::glance::api class { '::tripleo::profile::base::glance::registry': sync_db => $pacemaker_master, - manage_service => false, - enabled => false, } if $step >= 4 { diff --git a/manifests/profile/pacemaker/keystone.pp b/manifests/profile/pacemaker/keystone.pp index 712d58d..42c44d4 100644 --- a/manifests/profile/pacemaker/keystone.pp +++ b/manifests/profile/pacemaker/keystone.pp @@ -60,8 +60,6 @@ class tripleo::profile::pacemaker::keystone ( class { '::tripleo::profile::base::keystone': sync_db => $pacemaker_master, - manage_service => false, - enabled => false, bootstrap_master => $pacemaker_master, manage_roles => $manage_roles, manage_endpoint => $manage_roles diff --git a/manifests/profile/pacemaker/loadbalancer.pp b/manifests/profile/pacemaker/loadbalancer.pp new file mode 100644 index 0000000..926b482 --- /dev/null +++ b/manifests/profile/pacemaker/loadbalancer.pp @@ -0,0 +1,99 @@ +# 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::loadbalancer +# +# Loadbalancer Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*enable_load_balancer*] +# (Optional) Whether load balancing is enabled for this cluster +# Defaults to hiera('enable_load_balancer', true) +# +class tripleo::profile::pacemaker::loadbalancer ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), + $enable_load_balancer = hiera('enable_load_balancer', true) +) { + + include ::tripleo::profile::base::loadbalancer + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + if $step >= 2 and $pacemaker_master and $enable_load_balancer { + # FIXME: we should not have to access tripleo::loadbalancer 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. + pacemaker::resource::service { 'haproxy': + clone_params => true, + } + + $control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip') + tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_control_vip': + vip_name => 'control', + ip_address => $control_vip, + } + + $public_vip = hiera('tripleo::loadbalancer::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, + } + + $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, + } + + $internal_api_vip = hiera('tripleo::loadbalancer::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, + } + + $storage_vip = hiera('tripleo::loadbalancer::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, + } + + $storage_mgmt_vip = hiera('tripleo::loadbalancer::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, + } + } + +} diff --git a/manifests/profile/pacemaker/memcached.pp b/manifests/profile/pacemaker/memcached.pp new file mode 100644 index 0000000..09af5d6 --- /dev/null +++ b/manifests/profile/pacemaker/memcached.pp @@ -0,0 +1,61 @@ +# 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::memcached +# +# Memcached Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::pacemaker::memcached ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), +) { + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + include ::tripleo::profile::base::memcached + + if $step >= 2 and $pacemaker_master { + pacemaker::resource::service { $::memcached::params::service_name : + clone_params => 'interleave=true', + require => Class['::memcached'], + } + } + + if $step >= 5 and $pacemaker_master { + pacemaker::constraint::base { 'memcached-then-openstack-core-constraint': + constraint_type => 'order', + first_resource => 'memcached-clone', + second_resource => 'openstack-core-clone', + first_action => 'start', + second_action => 'start', + require => [Pacemaker::Resource::Service['memcached'], + Pacemaker::Resource::Ocf['openstack-core']], + } + } +} diff --git a/manifests/profile/pacemaker/neutron/dhcp.pp b/manifests/profile/pacemaker/neutron/dhcp.pp index 841d225..1f3b178 100644 --- a/manifests/profile/pacemaker/neutron/dhcp.pp +++ b/manifests/profile/pacemaker/neutron/dhcp.pp @@ -34,11 +34,8 @@ class tripleo::profile::pacemaker::neutron::dhcp ( include ::neutron::params include ::tripleo::profile::pacemaker::neutron + include ::tripleo::profile::base::neutron::dhcp - class { '::tripleo::profile::base::neutron::dhcp': - manage_service => false, - enabled => false, - } if $step >= 5 and downcase($::hostname) == $pacemaker_master { pacemaker::resource::service { $::neutron::params::dhcp_agent_service: clone_params => 'interleave=true', diff --git a/manifests/profile/pacemaker/neutron/l3.pp b/manifests/profile/pacemaker/neutron/l3.pp index a900016..e1699cc 100644 --- a/manifests/profile/pacemaker/neutron/l3.pp +++ b/manifests/profile/pacemaker/neutron/l3.pp @@ -34,11 +34,8 @@ class tripleo::profile::pacemaker::neutron::l3 ( include ::neutron::params include ::tripleo::profile::pacemaker::neutron + include ::tripleo::profile::base::neutron::l3 - class { '::tripleo::profile::base::neutron::l3': - manage_service => false, - enabled => false, - } if $step >= 5 and downcase($::hostname) == $pacemaker_master { pacemaker::resource::service { $::neutron::params::l3_agent_service: clone_params => 'interleave=true', diff --git a/manifests/profile/pacemaker/neutron/metadata.pp b/manifests/profile/pacemaker/neutron/metadata.pp index 4030bb2..e6bccb1 100644 --- a/manifests/profile/pacemaker/neutron/metadata.pp +++ b/manifests/profile/pacemaker/neutron/metadata.pp @@ -34,11 +34,8 @@ class tripleo::profile::pacemaker::neutron::metadata ( include ::neutron::params include ::tripleo::profile::pacemaker::neutron + include ::tripleo::profile::base::neutron::metadata - class { '::tripleo::profile::base::neutron::metadata': - manage_service => false, - enabled => false, - } if $step >= 5 and downcase($::hostname) == $pacemaker_master { pacemaker::resource::service { $::neutron::params::metadata_agent_service: clone_params => 'interleave=true', diff --git a/manifests/profile/pacemaker/neutron/ovs.pp b/manifests/profile/pacemaker/neutron/ovs.pp index c3ce36e..34ff5d3 100644 --- a/manifests/profile/pacemaker/neutron/ovs.pp +++ b/manifests/profile/pacemaker/neutron/ovs.pp @@ -34,11 +34,7 @@ class tripleo::profile::pacemaker::neutron::ovs ( include ::neutron::params include ::tripleo::profile::pacemaker::neutron - - class { '::tripleo::profile::base::neutron::ovs': - manage_service => false, - enabled => false, - } + include ::tripleo::profile::base::neutron::ovs if $step >= 5 and downcase($::hostname) == $pacemaker_master { diff --git a/manifests/profile/pacemaker/neutron/server.pp b/manifests/profile/pacemaker/neutron/server.pp index 4ff2e88..83e8a2a 100644 --- a/manifests/profile/pacemaker/neutron/server.pp +++ b/manifests/profile/pacemaker/neutron/server.pp @@ -38,8 +38,6 @@ class tripleo::profile::pacemaker::neutron::server ( class { '::tripleo::profile::base::neutron::server': sync_db => ($::hostname == downcase($pacemaker_master)), - manage_service => false, - enabled => false, } if ($::hostname == downcase($pacemaker_master)) { diff --git a/manifests/profile/pacemaker/rabbitmq.pp b/manifests/profile/pacemaker/rabbitmq.pp new file mode 100644 index 0000000..efb91b5 --- /dev/null +++ b/manifests/profile/pacemaker/rabbitmq.pp @@ -0,0 +1,67 @@ +# 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::rabbitmq +# +# RabbitMQ Pacemaker HA profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +# [*erlang_cookie*] +# (Optional) Content of erlang cookie. +# Defaults to hiera('rabbitmq::erlang_cookie'). +# +class tripleo::profile::pacemaker::rabbitmq ( + $bootstrap_node = hiera('bootstrap_nodeid'), + $step = hiera('step'), + $erlang_cookie = hiera('rabbitmq::erlang_cookie'), +) { + + 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 >= 2 and $pacemaker_master { + pacemaker::resource::ocf { 'rabbitmq': + ocf_agent_name => 'heartbeat:rabbitmq-cluster', + resource_params => 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\'', + clone_params => 'ordered=true interleave=true', + meta_params => 'notify=true', + require => Class['::rabbitmq'], + } + } +} |