Merge "Remove ControllerClusterConfig from overcloud.yaml"
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller_pacemaker.pp
index b3b6ce5..5c6e15a 100644 (file)
@@ -23,10 +23,8 @@ Service <|
   tag == 'aodh-service' or
   tag == 'cinder-service' or
   tag == 'ceilometer-service' or
-  tag == 'glance-service' or
   tag == 'gnocchi-service' or
   tag == 'heat-service' or
-  tag == 'keystone-service' or
   tag == 'neutron-service' or
   tag == 'nova-service' or
   tag == 'sahara-service'
@@ -48,7 +46,7 @@ if $::hostname == downcase(hiera('bootstrap_nodeid')) {
   $sync_db = false
 }
 
-$enable_fencing = str2bool(hiera('enable_fencing', false)) and hiera('step') >= 6
+$enable_fencing = str2bool(hiera('enable_fencing', false)) and hiera('step') >= 5
 $enable_load_balancer = hiera('enable_load_balancer', true)
 
 # When to start and enable services which haven't been Pacemakerized
@@ -101,6 +99,10 @@ if hiera('step') >= 1 {
   if $enable_fencing {
     include ::tripleo::fencing
 
+    # enable stonith after all Pacemaker resources have been created
+    Pcmk_resource<||> -> Class['tripleo::fencing']
+    Pcmk_constraint<||> -> Class['tripleo::fencing']
+    Exec <| tag == 'pacemaker_constraint' |> -> Class['tripleo::fencing']
     # enable stonith after all fencing devices have been created
     Class['tripleo::fencing'] -> Class['pacemaker::stonith']
   }
@@ -112,35 +114,6 @@ if hiera('step') >= 1 {
     op_params => 'start timeout=200s stop timeout=200s',
   }
 
-  # Only configure RabbitMQ in this step, don't start it yet to
-  # avoid races where non-master nodes attempt to start without
-  # config (eg. binding on 0.0.0.0)
-  # The module ignores erlang_cookie if cluster_config is false
-  $rabbit_ipv6 = str2bool(hiera('rabbit_ipv6', false))
-  if $rabbit_ipv6 {
-      $rabbit_env = merge(hiera('rabbitmq_environment'), {
-        'RABBITMQ_SERVER_START_ARGS' => '"-proto_dist inet6_tcp"'
-      })
-  } else {
-    $rabbit_env = hiera('rabbitmq_environment')
-  }
-
-  class { '::rabbitmq':
-    service_manage          => false,
-    tcp_keepalive           => false,
-    config_kernel_variables => hiera('rabbitmq_kernel_variables'),
-    config_variables        => hiera('rabbitmq_config_variables'),
-    environment_variables   => $rabbit_env,
-  } ->
-  file { '/var/lib/rabbitmq/.erlang.cookie':
-    ensure  => file,
-    owner   => 'rabbitmq',
-    group   => 'rabbitmq',
-    mode    => '0400',
-    content => hiera('rabbitmq::erlang_cookie'),
-    replace => true,
-  }
-
   if downcase(hiera('ceilometer_backend')) == 'mongodb' {
     include ::mongodb::globals
     include ::mongodb::client
@@ -302,14 +275,6 @@ if hiera('step') >= 2 {
       require      => Class['::memcached'],
     }
 
-    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'],
-    }
-
     if downcase(hiera('ceilometer_backend')) == 'mongodb' {
       pacemaker::resource::service { $::mongodb::params::service_name :
         op_params    => 'start timeout=370s stop timeout=200s',
@@ -379,12 +344,6 @@ MYSQL_HOST=localhost\n",
 
   # Create all the database schemas
   if $sync_db {
-    class { '::keystone::db::mysql':
-      require => Exec['galera-ready'],
-    }
-    class { '::glance::db::mysql':
-      require => Exec['galera-ready'],
-    }
     class { '::nova::db::mysql':
       require => Exec['galera-ready'],
     }
@@ -473,7 +432,7 @@ MYSQL_HOST=localhost\n",
 
 } #END STEP 2
 
-if hiera('step') >= 4 {
+if hiera('step') >= 4 or ( hiera('step') >= 3 and $sync_db ) {
 
   $nova_ipv6 = hiera('nova::use_ipv6', false)
   if $nova_ipv6 {
@@ -596,31 +555,6 @@ if hiera('step') >= 4 {
       metadata_proxy_shared_secret => hiera('nova::api::neutron_metadata_proxy_shared_secret'),
     }
   }
-  if hiera('neutron::enable_dhcp_agent',true) {
-    class { '::neutron::agents::dhcp' :
-      manage_service => false,
-      enabled        => false,
-    }
-    file { '/etc/neutron/dnsmasq-neutron.conf':
-      content => hiera('neutron_dnsmasq_options'),
-      owner   => 'neutron',
-      group   => 'neutron',
-      notify  => Service['neutron-dhcp-service'],
-      require => Package['neutron'],
-    }
-  }
-  if hiera('neutron::enable_l3_agent',true) {
-    class { '::neutron::agents::l3' :
-      manage_service => false,
-      enabled        => false,
-    }
-  }
-  if hiera('neutron::enable_metadata_agent',true) {
-    class { '::neutron::agents::metadata':
-      manage_service => false,
-      enabled        => false,
-    }
-  }
   include ::neutron::plugins::ml2
   class { '::neutron::agents::ml2::ovs':
     manage_service => false,
@@ -652,15 +586,6 @@ if hiera('step') >= 4 {
     include ::neutron::plugins::ml2::bigswitch::restproxy
     include ::neutron::agents::bigswitch
   }
-  neutron_l3_agent_config {
-    'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
-  }
-  neutron_dhcp_agent_config {
-    'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false);
-  }
-  neutron_config {
-    'DEFAULT/notification_driver': value => 'messaging';
-  }
 
   include ::cinder
   include ::cinder::config
@@ -1153,43 +1078,6 @@ if hiera('step') >= 5 {
                           Pacemaker::Resource::Service[$::sahara::params::engine_service_name]],
     }
 
-    if hiera('step') == 5 {
-      # Neutron
-      # NOTE(gfidente): Neutron will try to populate the database with some data
-      # as soon as neutron-server is started; to avoid races we want to make this
-      # happen only on one node, before normal Pacemaker initialization
-      # https://bugzilla.redhat.com/show_bug.cgi?id=1233061
-      # NOTE(emilien): we need to run this Exec only at Step 4 otherwise this exec
-      # will try to start the service while it's already started by Pacemaker
-      # It would result to a deployment failure since systemd would return 1 to Puppet
-      # and the overcloud would fail to deploy (6 would be returned).
-      # This conditional prevents from a race condition during the deployment.
-      # https://bugzilla.redhat.com/show_bug.cgi?id=1290582
-      exec { 'neutron-server-systemd-start-sleep' :
-        command => 'systemctl start neutron-server && /usr/bin/sleep 5',
-        path    => '/usr/bin',
-        unless  => '/sbin/pcs resource show neutron-server',
-      } ->
-      pacemaker::resource::service { $::neutron::params::server_service:
-        clone_params => 'interleave=true',
-        require      => Pacemaker::Resource::Ocf['openstack-core']
-      }
-    } else {
-      pacemaker::resource::service { $::neutron::params::server_service:
-        clone_params => 'interleave=true',
-        require      => Pacemaker::Resource::Ocf['openstack-core']
-      }
-    }
-    if hiera('neutron::enable_l3_agent', true) {
-      pacemaker::resource::service { $::neutron::params::l3_agent_service:
-        clone_params => 'interleave=true',
-      }
-    }
-    if hiera('neutron::enable_dhcp_agent', true) {
-      pacemaker::resource::service { $::neutron::params::dhcp_agent_service:
-        clone_params => 'interleave=true',
-      }
-    }
     if hiera('neutron::enable_ovs_agent', true) {
       pacemaker::resource::service { $::neutron::params::ovs_agent_service:
         clone_params => 'interleave=true',
@@ -1200,11 +1088,6 @@ if hiera('step') >= 5 {
         clone_params => 'interleave=true',
       }
     }
-    if hiera('neutron::enable_metadata_agent', true) {
-      pacemaker::resource::service { $::neutron::params::metadata_agent_service:
-        clone_params => 'interleave=true',
-      }
-    }
     if hiera('neutron::enable_ovs_agent', true) {
       pacemaker::resource::ocf { $::neutron::params::ovs_cleanup_service:
         ocf_agent_name => 'neutron:OVSCleanup',
@@ -1249,81 +1132,6 @@ if hiera('step') >= 5 {
                     Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service]],
       }
     }
-    pacemaker::constraint::base { 'keystone-to-neutron-server-constraint':
-      constraint_type => 'order',
-      first_resource  => 'openstack-core-clone',
-      second_resource => "${::neutron::params::server_service}-clone",
-      first_action    => 'start',
-      second_action   => 'start',
-      require         => [Pacemaker::Resource::Ocf['openstack-core'],
-                          Pacemaker::Resource::Service[$::neutron::params::server_service]],
-    }
-    if hiera('neutron::enable_ovs_agent',true) {
-      pacemaker::constraint::base { 'neutron-openvswitch-agent-to-dhcp-agent-constraint':
-        constraint_type => 'order',
-        first_resource  => "${::neutron::params::ovs_agent_service}-clone",
-        second_resource => "${::neutron::params::dhcp_agent_service}-clone",
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service],
-                            Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service]],
-      }
-    }
-    if hiera('neutron::enable_dhcp_agent',true) and hiera('neutron::enable_ovs_agent',true) {
-      pacemaker::constraint::base { 'neutron-server-to-openvswitch-agent-constraint':
-        constraint_type => 'order',
-        first_resource  => "${::neutron::params::server_service}-clone",
-        second_resource => "${::neutron::params::ovs_agent_service}-clone",
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Service[$::neutron::params::server_service],
-                            Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service]],
-    }
-
-      pacemaker::constraint::colocation { 'neutron-openvswitch-agent-to-dhcp-agent-colocation':
-        source  => "${::neutron::params::dhcp_agent_service}-clone",
-        target  => "${::neutron::params::ovs_agent_service}-clone",
-        score   => 'INFINITY',
-        require => [Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service],
-                    Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service]],
-      }
-    }
-    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",
-        second_resource => "${::neutron::params::l3_agent_service}-clone",
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service],
-                            Pacemaker::Resource::Service[$::neutron::params::l3_agent_service]]
-      }
-      pacemaker::constraint::colocation { 'neutron-dhcp-agent-to-l3-agent-colocation':
-        source  => "${::neutron::params::l3_agent_service}-clone",
-        target  => "${::neutron::params::dhcp_agent_service}-clone",
-        score   => 'INFINITY',
-        require => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service],
-                    Pacemaker::Resource::Service[$::neutron::params::l3_agent_service]]
-      }
-    }
-    if hiera('neutron::enable_l3_agent',true) and hiera('neutron::enable_metadata_agent',true) {
-      pacemaker::constraint::base { 'neutron-l3-agent-to-metadata-agent-constraint':
-        constraint_type => 'order',
-        first_resource  => "${::neutron::params::l3_agent_service}-clone",
-        second_resource => "${::neutron::params::metadata_agent_service}-clone",
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Service[$::neutron::params::l3_agent_service],
-                            Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]]
-      }
-      pacemaker::constraint::colocation { 'neutron-l3-agent-to-metadata-agent-colocation':
-        source  => "${::neutron::params::metadata_agent_service}-clone",
-        target  => "${::neutron::params::l3_agent_service}-clone",
-        score   => 'INFINITY',
-        require => [Pacemaker::Resource::Service[$::neutron::params::l3_agent_service],
-                    Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]]
-      }
-    }
     if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
       #midonet-chain chain keystone-->neutron-server-->dhcp-->metadata->tomcat
       pacemaker::constraint::base { 'neutron-server-to-dhcp-agent-constraint':