Run sync in step 3 when $sync_db
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller_pacemaker.pp
index f5d4cf9..0372a56 100644 (file)
@@ -255,183 +255,46 @@ if hiera('step') >= 2 {
       }
 
       $control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip')
-      if is_ipv6_address($control_vip) {
-        $control_vip_netmask = '64'
-      } else {
-        $control_vip_netmask = '32'
-      }
-      pacemaker::resource::ip { 'control_vip':
-        ip_address   => $control_vip,
-        cidr_netmask => $control_vip_netmask,
-      }
-      pacemaker::constraint::base { 'control_vip-then-haproxy':
-        constraint_type   => 'order',
-        first_resource    => "ip-${control_vip}",
-        second_resource   => 'haproxy-clone',
-        first_action      => 'start',
-        second_action     => 'start',
-        constraint_params => 'kind=Optional',
-        require           => [Pacemaker::Resource::Service['haproxy'],
-                              Pacemaker::Resource::Ip['control_vip']],
-      }
-      pacemaker::constraint::colocation { 'control_vip-with-haproxy':
-        source  => "ip-${control_vip}",
-        target  => 'haproxy-clone',
-        score   => 'INFINITY',
-        require => [Pacemaker::Resource::Service['haproxy'],
-                    Pacemaker::Resource::Ip['control_vip']],
+      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_control_vip':
+        vip_name   => 'control',
+        ip_address => $control_vip,
       }
 
       $public_vip = hiera('tripleo::loadbalancer::public_virtual_ip')
-      if is_ipv6_address($public_vip) {
-        $public_vip_netmask = '64'
-      } else {
-        $public_vip_netmask = '32'
-      }
-      if $public_vip and $public_vip != $control_vip {
-        pacemaker::resource::ip { 'public_vip':
-          ip_address   => $public_vip,
-          cidr_netmask => $public_vip_netmask,
-        }
-        pacemaker::constraint::base { 'public_vip-then-haproxy':
-          constraint_type   => 'order',
-          first_resource    => "ip-${public_vip}",
-          second_resource   => 'haproxy-clone',
-          first_action      => 'start',
-          second_action     => 'start',
-          constraint_params => 'kind=Optional',
-          require           => [Pacemaker::Resource::Service['haproxy'],
-                                Pacemaker::Resource::Ip['public_vip']],
-        }
-        pacemaker::constraint::colocation { 'public_vip-with-haproxy':
-          source  => "ip-${public_vip}",
-          target  => 'haproxy-clone',
-          score   => 'INFINITY',
-          require => [Pacemaker::Resource::Service['haproxy'],
-                      Pacemaker::Resource::Ip['public_vip']],
-        }
+      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')
-      if is_ipv6_address($redis_vip) {
-        $redis_vip_netmask = '64'
-      } else {
-        $redis_vip_netmask = '32'
-      }
-      if $redis_vip and $redis_vip != $control_vip {
-        pacemaker::resource::ip { 'redis_vip':
-          ip_address   => $redis_vip,
-          cidr_netmask => $redis_vip_netmask,
-        }
-        pacemaker::constraint::base { 'redis_vip-then-haproxy':
-          constraint_type   => 'order',
-          first_resource    => "ip-${redis_vip}",
-          second_resource   => 'haproxy-clone',
-          first_action      => 'start',
-          second_action     => 'start',
-          constraint_params => 'kind=Optional',
-          require           => [Pacemaker::Resource::Service['haproxy'],
-                                Pacemaker::Resource::Ip['redis_vip']],
-        }
-        pacemaker::constraint::colocation { 'redis_vip-with-haproxy':
-          source  => "ip-${redis_vip}",
-          target  => 'haproxy-clone',
-          score   => 'INFINITY',
-          require => [Pacemaker::Resource::Service['haproxy'],
-                      Pacemaker::Resource::Ip['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')
-      if is_ipv6_address($internal_api_vip) {
-        $internal_api_vip_netmask = '64'
-      } else {
-        $internal_api_vip_netmask = '32'
-      }
-      if $internal_api_vip and $internal_api_vip != $control_vip {
-        pacemaker::resource::ip { 'internal_api_vip':
-          ip_address   => $internal_api_vip,
-          cidr_netmask => $internal_api_vip_netmask,
-        }
-        pacemaker::constraint::base { 'internal_api_vip-then-haproxy':
-          constraint_type   => 'order',
-          first_resource    => "ip-${internal_api_vip}",
-          second_resource   => 'haproxy-clone',
-          first_action      => 'start',
-          second_action     => 'start',
-          constraint_params => 'kind=Optional',
-          require           => [Pacemaker::Resource::Service['haproxy'],
-                                Pacemaker::Resource::Ip['internal_api_vip']],
-        }
-        pacemaker::constraint::colocation { 'internal_api_vip-with-haproxy':
-          source  => "ip-${internal_api_vip}",
-          target  => 'haproxy-clone',
-          score   => 'INFINITY',
-          require => [Pacemaker::Resource::Service['haproxy'],
-                      Pacemaker::Resource::Ip['internal_api_vip']],
-        }
+      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')
-      if is_ipv6_address($storage_vip) {
-        $storage_vip_netmask = '64'
-      } else {
-        $storage_vip_netmask = '32'
-      }
-      if $storage_vip and $storage_vip != $control_vip {
-        pacemaker::resource::ip { 'storage_vip':
-          ip_address   => $storage_vip,
-          cidr_netmask => $storage_vip_netmask,
-        }
-        pacemaker::constraint::base { 'storage_vip-then-haproxy':
-          constraint_type   => 'order',
-          first_resource    => "ip-${storage_vip}",
-          second_resource   => 'haproxy-clone',
-          first_action      => 'start',
-          second_action     => 'start',
-          constraint_params => 'kind=Optional',
-          require           => [Pacemaker::Resource::Service['haproxy'],
-                                Pacemaker::Resource::Ip['storage_vip']],
-        }
-        pacemaker::constraint::colocation { 'storage_vip-with-haproxy':
-          source  => "ip-${storage_vip}",
-          target  => 'haproxy-clone',
-          score   => 'INFINITY',
-          require => [Pacemaker::Resource::Service['haproxy'],
-                      Pacemaker::Resource::Ip['storage_vip']],
-        }
+      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')
-      if is_ipv6_address($storage_mgmt_vip) {
-        $storage_mgmt_vip_netmask = '64'
-      } else {
-        $storage_mgmt_vip_netmask = '32'
-      }
-      if $storage_mgmt_vip and $storage_mgmt_vip != $control_vip {
-        pacemaker::resource::ip { 'storage_mgmt_vip':
-          ip_address   => $storage_mgmt_vip,
-          cidr_netmask => $storage_mgmt_vip_netmask,
-        }
-        pacemaker::constraint::base { 'storage_mgmt_vip-then-haproxy':
-          constraint_type   => 'order',
-          first_resource    => "ip-${storage_mgmt_vip}",
-          second_resource   => 'haproxy-clone',
-          first_action      => 'start',
-          second_action     => 'start',
-          constraint_params => 'kind=Optional',
-          require           => [Pacemaker::Resource::Service['haproxy'],
-                                Pacemaker::Resource::Ip['storage_mgmt_vip']],
-        }
-        pacemaker::constraint::colocation { 'storage_mgmt_vip-with-haproxy':
-          source  => "ip-${storage_mgmt_vip}",
-          target  => 'haproxy-clone',
-          score   => 'INFINITY',
-          require => [Pacemaker::Resource::Service['haproxy'],
-                      Pacemaker::Resource::Ip['storage_mgmt_vip']],
-        }
+      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,
       }
-
     }
 
     pacemaker::resource::service { $::memcached::params::service_name :
@@ -610,33 +473,7 @@ MYSQL_HOST=localhost\n",
 
 } #END STEP 2
 
-if hiera('step') >= 4 {
-
-  $glance_backend = downcase(hiera('glance_backend', 'swift'))
-  case $glance_backend {
-      'swift': { $backend_store = 'glance.store.swift.Store' }
-      'file': { $backend_store = 'glance.store.filesystem.Store' }
-      'rbd': { $backend_store = 'glance.store.rbd.Store' }
-      default: { fail('Unrecognized glance_backend parameter.') }
-  }
-  $http_store = ['glance.store.http.Store']
-  $glance_store = concat($http_store, $backend_store)
-
-  # TODO: notifications, scrubber, etc.
-  include ::glance
-  include ::glance::config
-  class { '::glance::api':
-    known_stores   => $glance_store,
-    manage_service => false,
-    enabled        => false,
-  }
-  class { '::glance::registry' :
-    sync_db        => $sync_db,
-    manage_service => false,
-    enabled        => false,
-  }
-  include ::glance::notify::rabbitmq
-  include join(['::glance::backend::', $glance_backend])
+if hiera('step') >= 4 or ( hiera('step') >= 3 and $sync_db ) {
 
   $nova_ipv6 = hiera('nova::use_ipv6', false)
   if $nova_ipv6 {
@@ -876,6 +713,7 @@ if hiera('step') >= 4 {
     $cinder_rbd_backend = 'tripleo_ceph'
 
     cinder::backend::rbd { $cinder_rbd_backend :
+      backend_host    => hiera('cinder::host'),
       rbd_pool        => hiera('cinder_rbd_pool_name'),
       rbd_user        => hiera('ceph_client_user_name'),
       rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
@@ -1096,6 +934,7 @@ if hiera('step') >= 4 {
     service_enable => false,
     # service_manage => false, # <-- not supported with horizon&apache mod_wsgi?
   }
+  include ::apache::mod::remoteip
   include ::apache::mod::status
   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
     $_profile_support = 'cisco'
@@ -1304,52 +1143,14 @@ if hiera('step') >= 5 {
       require         => [Pacemaker::Resource::Service[$::sahara::params::api_service_name],
                           Pacemaker::Resource::Ocf['openstack-core']],
     }
-
-    # Glance
-    if $glance_backend == 'file' and hiera('glance_file_pcmk_manage', false) {
-      $secontext = 'context="system_u:object_r:glance_var_lib_t:s0"'
-      pacemaker::resource::filesystem { 'glance-fs':
-        device           => hiera('glance_file_pcmk_device'),
-        directory        => hiera('glance_file_pcmk_directory'),
-        fstype           => hiera('glance_file_pcmk_fstype'),
-        fsoptions        => join([$secontext, hiera('glance_file_pcmk_options', '')],','),
-        verify_on_create => true,
-        clone_params     => '',
-      }
-    }
-
-    pacemaker::resource::service { $::glance::params::registry_service_name :
-      clone_params => 'interleave=true',
-      require      => Pacemaker::Resource::Ocf['openstack-core'],
-    }
-    pacemaker::resource::service { $::glance::params::api_service_name :
-      clone_params => 'interleave=true',
-    }
-
-    pacemaker::constraint::base { 'keystone-then-glance-registry-constraint':
-      constraint_type => 'order',
-      first_resource  => 'openstack-core-clone',
-      second_resource => "${::glance::params::registry_service_name}-clone",
-      first_action    => 'start',
-      second_action   => 'start',
-      require         => [Pacemaker::Resource::Service[$::glance::params::registry_service_name],
-                          Pacemaker::Resource::Ocf['openstack-core']],
-    }
-    pacemaker::constraint::base { 'glance-registry-then-glance-api-constraint':
+    pacemaker::constraint::base { 'sahara-api-then-sahara-engine-constraint':
       constraint_type => 'order',
-      first_resource  => "${::glance::params::registry_service_name}-clone",
-      second_resource => "${::glance::params::api_service_name}-clone",
+      first_resource  => "${::sahara::params::api_service_name}-clone",
+      second_resource => "${::sahara::params::engine_service_name}-clone",
       first_action    => 'start',
       second_action   => 'start',
-      require         => [Pacemaker::Resource::Service[$::glance::params::registry_service_name],
-                          Pacemaker::Resource::Service[$::glance::params::api_service_name]],
-    }
-    pacemaker::constraint::colocation { 'glance-api-with-glance-registry-colocation':
-      source  => "${::glance::params::api_service_name}-clone",
-      target  => "${::glance::params::registry_service_name}-clone",
-      score   => 'INFINITY',
-      require => [Pacemaker::Resource::Service[$::glance::params::registry_service_name],
-                  Pacemaker::Resource::Service[$::glance::params::api_service_name]],
+      require         => [Pacemaker::Resource::Service[$::sahara::params::api_service_name],
+                          Pacemaker::Resource::Service[$::sahara::params::engine_service_name]],
     }
 
     if hiera('step') == 5 {
@@ -1487,7 +1288,7 @@ if hiera('step') >= 5 {
                     Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service]],
       }
     }
-    if hiera('neutron::enable_dhcp_agent',true) and hiera('l3_agent_service',true) {
+    if hiera('neutron::enable_dhcp_agent',true) and hiera('neutron::enable_l3_agent',true) {
       pacemaker::constraint::base { 'neutron-dhcp-agent-to-l3-agent-constraint':
         constraint_type => 'order',
         first_resource  => "${::neutron::params::dhcp_agent_service}-clone",
@@ -1720,6 +1521,15 @@ if hiera('step') >= 5 {
       require         => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
                           Pacemaker::Resource::Ocf['openstack-core']],
     }
+    pacemaker::constraint::base { 'keystone-then-ceilometer-notification-constraint':
+      constraint_type => 'order',
+      first_resource  => 'openstack-core-clone',
+      second_resource => "${::ceilometer::params::agent_notification_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
+                          Pacemaker::Resource::Ocf['openstack-core']],
+    }
     pacemaker::constraint::base { 'ceilometer-central-then-ceilometer-collector-constraint':
       constraint_type => 'order',
       first_resource  => "${::ceilometer::params::agent_central_service_name}-clone",
@@ -1803,6 +1613,15 @@ if hiera('step') >= 5 {
       require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
                   Pacemaker::Resource::Service[$::aodh::params::notifier_service_name]],
     }
+    pacemaker::constraint::base { 'aodh-evaluator-then-aodh-listener-constraint':
+      constraint_type => 'order',
+      first_resource  => "${::aodh::params::evaluator_service_name}-clone",
+      second_resource => "${::aodh::params::listener_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
+                          Pacemaker::Resource::Service[$::aodh::params::listener_service_name]],
+    }
     pacemaker::constraint::colocation { 'aodh-listener-with-aodh-evaluator-colocation':
       source  => "${::aodh::params::listener_service_name}-clone",
       target  => "${::aodh::params::evaluator_service_name}-clone",
@@ -1859,15 +1678,6 @@ if hiera('step') >= 5 {
     pacemaker::resource::service { $::heat::params::engine_service_name :
       clone_params => 'interleave=true',
     }
-    pacemaker::constraint::base { 'keystone-then-heat-api-constraint':
-      constraint_type => 'order',
-      first_resource  => 'openstack-core-clone',
-      second_resource => "${::heat::params::api_service_name}-clone",
-      first_action    => 'start',
-      second_action   => 'start',
-      require         => [Pacemaker::Resource::Service[$::heat::params::api_service_name],
-                          Pacemaker::Resource::Ocf['openstack-core']],
-    }
     pacemaker::constraint::base { 'heat-api-then-heat-api-cfn-constraint':
       constraint_type => 'order',
       first_resource  => "${::heat::params::api_service_name}-clone",