Always start httpd at the same time
authorJuan Antonio Osorio Robles <jaosorior@redhat.com>
Wed, 21 Jun 2017 12:43:25 +0000 (15:43 +0300)
committerJuan Antonio Osorio Robles <jaosorior@redhat.com>
Tue, 27 Jun 2017 11:38:45 +0000 (14:38 +0300)
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>
14 files changed:
manifests/profile/base/aodh/api.pp
manifests/profile/base/ceilometer/api.pp
manifests/profile/base/heat/api.pp
manifests/profile/base/heat/api_cfn.pp
manifests/profile/base/heat/api_cloudwatch.pp
manifests/profile/base/horizon.pp
manifests/profile/base/mistral/api.pp
manifests/profile/base/nova/placement.pp
manifests/profile/base/zaqar.pp
releasenotes/notes/start-httpd-step3-and-4-2bd7be9e1429ef6d.yaml [new file with mode: 0644]
spec/classes/tripleo_profile_base_aodh_api_spec.rb
spec/classes/tripleo_profile_base_ceilometer_api_spec.rb
spec/classes/tripleo_profile_base_horizon_spec.rb
spec/classes/tripleo_profile_base_nova_placement_spec.rb

index 300c0ca..d6ec32b 100644 (file)
 #   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.
 
 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':
index 6a30a40..11c1da3 100644 (file)
 #   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.
 #   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':
index ff90590..2221b37 100644 (file)
 #
 # === 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.
 #   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':
index e14760a..1014b04 100644 (file)
 #
 # === 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.
 #   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
index 83d5307..4caac9d 100644 (file)
 #
 # === 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.
 #   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
index 12482b6..26ea20f 100644 (file)
 #   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
index 2ea5c9a..b5ca85e 100644 (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':
index ac78287..48af39a 100644 (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,
index b9171b0..063ccb8 100644 (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
 #   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)) {
diff --git a/releasenotes/notes/start-httpd-step3-and-4-2bd7be9e1429ef6d.yaml b/releasenotes/notes/start-httpd-step3-and-4-2bd7be9e1429ef6d.yaml
new file mode 100644 (file)
index 0000000..02e0d48
--- /dev/null
@@ -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.
index a82cf49..27bd735 100644 (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')
index cec2b54..9cb657f 100644 (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
index fb076b8..d8a672b 100644 (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')
index 04e032a..574489e 100644 (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',