Always start httpd at the same time

Puppet wipes out whatever is not in it's resource catalog each run for
httpd. This causes httpd to restart if in the next step there are
reasources added that were not there earlier.

This patch, thus changes the instances of httpd to start at the same
time: On step 3 for the bootstrap node, and on step 4 for every other
node.

Closes-Bug: #1699502
Change-Id: I3d29728c1ab7bd5b78100f89e00e5fa082f97b0c
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
Juan Antonio Osorio Robles 2017-06-21 15:43:25 +03:00
parent 3fcafacc1e
commit ad14f23c11
14 changed files with 186 additions and 23 deletions

View File

@ -23,6 +23,10 @@
# This is set by t-h-t.
# Defaults to hiera('aodh_api_network', undef)
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
@ -47,10 +51,16 @@
class tripleo::profile::base::aodh::api (
$aodh_network = hiera('aodh_api_network', undef),
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$step = Integer(hiera('step')),
) {
if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true
} else {
$is_bootstrap = false
}
include ::tripleo::profile::base::aodh
@ -66,7 +76,7 @@ class tripleo::profile::base::aodh::api (
}
if $step >= 3 {
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::aodh::api
include ::apache::mod::ssl
class { '::aodh::wsgi::apache':

View File

@ -23,6 +23,10 @@
# This is set by t-h-t.
# Defaults to hiera('ceilometer_api_network', undef)
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
@ -45,11 +49,18 @@
# Defaults to hiera('step')
#
class tripleo::profile::base::ceilometer::api (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$ceilometer_network = hiera('ceilometer_api_network', undef),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$step = Integer(hiera('step')),
) {
if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true
} else {
$is_bootstrap = false
}
include ::tripleo::profile::base::ceilometer
if $enable_internal_tls {
@ -63,7 +74,7 @@ class tripleo::profile::base::ceilometer::api (
$tls_keyfile = undef
}
if $step >= 3 {
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::ceilometer::api
include ::apache::mod::ssl
class { '::ceilometer::wsgi::apache':

View File

@ -18,6 +18,10 @@
#
# === Parameters
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
@ -45,11 +49,18 @@
# Defaults to hiera('step')
#
class tripleo::profile::base::heat::api (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$heat_api_network = hiera('heat_api_network', undef),
$step = Integer(hiera('step')),
) {
if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true
} else {
$is_bootstrap = false
}
include ::tripleo::profile::base::heat
if $enable_internal_tls {
@ -63,7 +74,7 @@ class tripleo::profile::base::heat::api (
$tls_keyfile = undef
}
if $step >= 3 {
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::heat::api
include ::apache::mod::ssl
class { '::heat::wsgi::apache_api':

View File

@ -18,6 +18,10 @@
#
# === Parameters
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
@ -45,11 +49,18 @@
# Defaults to hiera('step')
#
class tripleo::profile::base::heat::api_cfn (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$heat_api_cfn_network = hiera('heat_api_cfn_network', undef),
$step = Integer(hiera('step')),
) {
if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true
} else {
$is_bootstrap = false
}
include ::tripleo::profile::base::heat
if $enable_internal_tls {
@ -63,7 +74,7 @@ class tripleo::profile::base::heat::api_cfn (
$tls_keyfile = undef
}
if $step >= 3 {
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::heat::api_cfn
include ::apache::mod::ssl

View File

@ -18,6 +18,10 @@
#
# === Parameters
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
@ -45,11 +49,18 @@
# Defaults to hiera('step')
#
class tripleo::profile::base::heat::api_cloudwatch (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$heat_api_cloudwatch_network = hiera('heat_api_cloudwatch_network', undef),
$step = Integer(hiera('step')),
) {
if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true
} else {
$is_bootstrap = false
}
include ::tripleo::profile::base::heat
if $enable_internal_tls {
@ -63,7 +74,7 @@ class tripleo::profile::base::heat::api_cloudwatch (
$tls_keyfile = undef
}
if $step >= 3 {
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::heat::api_cloudwatch
include ::apache::mod::ssl

View File

@ -23,15 +23,26 @@
# for more details.
# Defaults to hiera('step')
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
# [*neutron_options*]
# (Optional) A hash of parameters to enable features specific to Neutron
# Defaults to hiera('horizon::neutron_options', {})
#
class tripleo::profile::base::horizon (
$step = Integer(hiera('step')),
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$neutron_options = hiera('horizon::neutron_options', {}),
) {
if $step >= 3 {
if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true
} else {
$is_bootstrap = false
}
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
# Horizon
include ::apache::mod::remoteip
include ::apache::mod::status

View File

@ -56,9 +56,9 @@ class tripleo::profile::base::mistral::api (
$step = Integer(hiera('step')),
) {
if $::hostname == downcase($bootstrap_node) {
$sync_db = true
$is_bootstrap = true
} else {
$sync_db = false
$is_bootstrap = false
}
include ::tripleo::profile::base::mistral
@ -74,7 +74,7 @@ class tripleo::profile::base::mistral::api (
$tls_keyfile = undef
}
if $step >= 3 {
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::mistral::api
include ::apache::mod::ssl
class { '::mistral::wsgi::apache':

View File

@ -54,9 +54,9 @@ class tripleo::profile::base::nova::placement (
$step = Integer(hiera('step')),
) {
if $::hostname == downcase($bootstrap_node) {
$sync_db = true
$is_bootstrap = true
} else {
$sync_db = false
$is_bootstrap = false
}
include ::tripleo::profile::base::nova
@ -73,7 +73,7 @@ class tripleo::profile::base::nova::placement (
$tls_keyfile = undef
}
if $step >= 3 {
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::apache::mod::ssl
class { '::nova::wsgi::apache_placement':
ssl_cert => $tls_certfile,

View File

@ -18,9 +18,9 @@
#
# === Parameters
#
# [*sync_db*]
# (Optional) Whether to run db sync
# Defaults to true
# [*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
@ -28,9 +28,16 @@
# Defaults to hiera('step')
#
class tripleo::profile::base::zaqar (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$step = Integer(hiera('step')),
) {
if $step >= 4 {
if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true
} else {
$is_bootstrap = false
}
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::zaqar
if str2bool(hiera('mongodb::server::ipv6', false)) {

View File

@ -0,0 +1,5 @@
---
fixes:
- In order to avoid service restarts, all services deploy their httpd
configuration at the same time. Thus, httpd now starts in step 3 for the
bootstrap nodes, and step 4 for all other nodes.

View File

@ -33,11 +33,34 @@ describe 'tripleo::profile::base::aodh::api' do
end
end
context 'with step 3' do
context 'with step 3 and not bootstrap' do
let(:params) { {
:step => 3,
} }
it 'should trigger complete configuration' do
is_expected.not_to contain_class('aodh::api')
is_expected.not_to contain_class('aodh::wsgi::apache')
end
end
context 'with step 3 and bootstrap' do
let(:params) { {
:step => 3,
:bootstrap_node => 'node.example.com'
} }
it 'should trigger complete configuration' do
is_expected.to contain_class('aodh::api')
is_expected.to contain_class('aodh::wsgi::apache')
end
end
context 'with step 4' do
let(:params) { {
:step => 4,
} }
it 'should trigger complete configuration' do
is_expected.to contain_class('aodh::api')
is_expected.to contain_class('aodh::wsgi::apache')

View File

@ -32,9 +32,32 @@ describe 'tripleo::profile::base::ceilometer::api' do
end
end
context 'with step 3' do
context 'with step 3 and not bootstrap' do
let(:params) { {
:step => 3,
:step => 3,
} }
it 'should trigger complete configuration' do
is_expected.not_to contain_class('ceilometer::api')
is_expected.not_to contain_class('ceilometer::wsgi::apache')
end
end
context 'with step 3 and bootstrap' do
let(:params) { {
:step => 3,
:bootstrap_node => 'node.example.com'
} }
it 'should trigger complete configuration' do
is_expected.to contain_class('ceilometer::api')
is_expected.to contain_class('ceilometer::wsgi::apache')
end
end
context 'with step 4' do
let(:params) { {
:step => 4,
} }
it 'should trigger complete configuration' do

View File

@ -31,11 +31,37 @@ describe 'tripleo::profile::base::horizon' do
end
end
context 'with step 3' do
context 'with step 3 and not bootstrap' do
let(:params) { {
:step => 3,
} }
it 'should not configure anything' do
is_expected.to_not contain_class('horizon')
is_expected.to_not contain_class('apache::mod::remoteip')
is_expected.to_not contain_class('apache::mod::status')
end
end
context 'with step 3 and bootstrap' do
let(:params) { {
:step => 3,
:bootstrap_node => 'node.example.com'
} }
it 'should trigger complete configuration' do
is_expected.to contain_class('horizon')
is_expected.to contain_class('apache::mod::remoteip')
is_expected.to contain_class('apache::mod::status')
end
end
context 'with step 4' do
let(:params) { {
:step => 3,
:bootstrap_node => 'node.example.com'
} }
it 'should trigger complete configuration' do
is_expected.to contain_class('horizon')
is_expected.to contain_class('apache::mod::remoteip')

View File

@ -67,12 +67,25 @@ eos
}
end
context 'with step 3' do
context 'with step 3 and not bootstrap' do
let(:params) { {
:step => 3,
} }
it {
is_expected.to contain_class('tripleo::profile::base::nova::placement')
is_expected.to contain_class('tripleo::profile::base::nova')
is_expected.to contain_class('nova::keystone::authtoken')
is_expected.not_to contain_class('nova::wsgi::apache_placement')
}
end
context 'with step 3 and bootstrap' do
let(:params) { {
:step => 3,
:bootstrap_node => 'node.example.com'
} }
it {
is_expected.to contain_class('tripleo::profile::base::nova::placement')
is_expected.to contain_class('tripleo::profile::base::nova')
@ -81,11 +94,12 @@ eos
}
end
context 'with step 3 with enable_internal_tls and skip generate certs' do
context 'with step 3 and bootstrap with enable_internal_tls and skip generate certs' do
let(:params) { {
:step => 3,
:enable_internal_tls => true,
:nova_placement_network => 'bar',
:bootstrap_node => 'node.example.com',
:certificates_specs => {
'httpd-bar' => {
'hostname' => 'foo',