Fix MariaDB account removal race condition
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller_pacemaker.pp
index 5f5b06d..808c7a2 100644 (file)
@@ -158,12 +158,13 @@ if hiera('step') >= 1 {
   }
 
   class { '::mysql::server':
-    create_root_user   => false,
-    create_root_my_cnf => false,
-    config_file        => $mysql_config_file,
-    override_options   => $mysqld_options,
-    service_manage     => false,
-    service_enabled    => false,
+    create_root_user        => false,
+    create_root_my_cnf      => false,
+    config_file             => $mysql_config_file,
+    override_options        => $mysqld_options,
+    remove_default_accounts => $pacemaker_master,
+    service_manage          => false,
+    service_enabled         => false,
   }
 
 }
@@ -177,6 +178,8 @@ if hiera('step') >= 2 {
 
   if $pacemaker_master {
 
+    include pacemaker::resource_defaults
+
     # 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
@@ -407,71 +410,28 @@ MYSQL_HOST=localhost\n",
   }
 
   # Create all the database schemas
-  # Example DSN format: mysql://user:password@host/dbname
   if $sync_db {
-    $allowed_hosts = ['%',hiera('mysql_bind_host')]
-    $keystone_dsn = split(hiera('keystone::database_connection'), '[@:/?]')
     class { 'keystone::db::mysql':
-      user          => $keystone_dsn[3],
-      password      => $keystone_dsn[4],
-      host          => $keystone_dsn[5],
-      dbname        => $keystone_dsn[6],
-      allowed_hosts => $allowed_hosts,
       require       => Exec['galera-ready'],
     }
-    $glance_dsn = split(hiera('glance::api::database_connection'), '[@:/?]')
     class { 'glance::db::mysql':
-      user          => $glance_dsn[3],
-      password      => $glance_dsn[4],
-      host          => $glance_dsn[5],
-      dbname        => $glance_dsn[6],
-      allowed_hosts => $allowed_hosts,
       require       => Exec['galera-ready'],
     }
-    $nova_dsn = split(hiera('nova::database_connection'), '[@:/?]')
     class { 'nova::db::mysql':
-      user          => $nova_dsn[3],
-      password      => $nova_dsn[4],
-      host          => $nova_dsn[5],
-      dbname        => $nova_dsn[6],
-      allowed_hosts => $allowed_hosts,
       require       => Exec['galera-ready'],
     }
-    $neutron_dsn = split(hiera('neutron::server::database_connection'), '[@:/?]')
     class { 'neutron::db::mysql':
-      user          => $neutron_dsn[3],
-      password      => $neutron_dsn[4],
-      host          => $neutron_dsn[5],
-      dbname        => $neutron_dsn[6],
-      allowed_hosts => $allowed_hosts,
       require       => Exec['galera-ready'],
     }
-    $cinder_dsn = split(hiera('cinder::database_connection'), '[@:/?]')
     class { 'cinder::db::mysql':
-      user          => $cinder_dsn[3],
-      password      => $cinder_dsn[4],
-      host          => $cinder_dsn[5],
-      dbname        => $cinder_dsn[6],
-      allowed_hosts => $allowed_hosts,
       require       => Exec['galera-ready'],
     }
-    $heat_dsn = split(hiera('heat::database_connection'), '[@:/?]')
     class { 'heat::db::mysql':
-      user          => $heat_dsn[3],
-      password      => $heat_dsn[4],
-      host          => $heat_dsn[5],
-      dbname        => $heat_dsn[6],
-      allowed_hosts => $allowed_hosts,
       require       => Exec['galera-ready'],
     }
+
     if downcase(hiera('ceilometer_backend')) == 'mysql' {
-      $ceilometer_dsn = split(hiera('ceilometer_mysql_conn_string'), '[@:/?]')
       class { 'ceilometer::db::mysql':
-        user          => $ceilometer_dsn[3],
-        password      => $ceilometer_dsn[4],
-        host          => $ceilometer_dsn[5],
-        dbname        => $ceilometer_dsn[6],
-        allowed_hosts => $allowed_hosts,
         require       => Exec['galera-ready'],
       }
     }
@@ -481,8 +441,7 @@ MYSQL_HOST=localhost\n",
   include ::swift
 
   # Ceph
-  $cinder_enable_rbd_backend = hiera('cinder_enable_rbd_backend', false)
-  $enable_ceph = $cinder_enable_rbd_backend
+  $enable_ceph = hiera('ceph_storage_count', 0) > 0
 
   if $enable_ceph {
     class { 'ceph::profile::params':
@@ -492,10 +451,27 @@ MYSQL_HOST=localhost\n",
   }
 
   if str2bool(hiera('enable_ceph_storage', 'false')) {
-    include ::ceph::profile::client
+    if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
+      exec { 'set selinux to permissive on boot':
+        command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
+        onlyif  => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
+        path    => ["/usr/bin", "/usr/sbin"],
+      }
+
+      exec { 'set selinux to permissive':
+        command => "setenforce 0",
+        onlyif  => "which setenforce && getenforce | grep -i 'enforcing'",
+        path    => ["/usr/bin", "/usr/sbin"],
+      } -> Class['ceph::profile::osd']
+    }
+
     include ::ceph::profile::osd
   }
 
+  if str2bool(hiera('enable_external_ceph', 'false')) {
+    include ::ceph::profile::client
+  }
+
 
 } #END STEP 2
 
@@ -590,6 +566,7 @@ if hiera('step') >= 3 {
     manage_service => false,
     enabled => false,
   }
+  include ::nova::scheduler::filter
   class { '::nova::scheduler' :
     manage_service => false,
     enabled => false,
@@ -625,6 +602,7 @@ if hiera('step') >= 3 {
   class { 'neutron::plugins::ml2':
     flat_networks   => split(hiera('neutron_flat_networks'), ','),
     tenant_network_types => [hiera('neutron_tenant_network_type')],
+    mechanism_drivers   => [hiera('neutron_mechanism_drivers')],
   }
   class { 'neutron::agents::ml2::ovs':
     manage_service   => false,
@@ -633,6 +611,24 @@ if hiera('step') >= 3 {
     tunnel_types     => split(hiera('neutron_tunnel_types'), ','),
   }
 
+  if 'cisco_ucsm' in hiera('neutron_mechanism_drivers') {
+    include ::neutron::plugins::ml2::cisco::ucsm
+  }
+  if 'cisco_nexus' in hiera('neutron_mechanism_drivers') {
+    include ::neutron::plugins::ml2::cisco::nexus
+    include ::neutron::plugins::ml2::cisco::type_nexus_vxlan
+  }
+
+  if hiera('neutron_enable_bigswitch_ml2', false) {
+    include neutron::plugins::ml2::bigswitch::restproxy
+  }
+  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);
+  }
+
   include ::cinder
   class { '::cinder::api':
     sync_db => $sync_db,
@@ -672,20 +668,21 @@ if hiera('step') >= 3 {
 
     $ceph_pools = hiera('ceph_pools')
     ceph::pool { $ceph_pools : }
+
+    $cinder_pool_requires = [Ceph::Pool['volumes']]
+
+  } else {
+    $cinder_pool_requires = []
   }
 
-  if $cinder_enable_rbd_backend {
+  if hiera('cinder_enable_rbd_backend', false) {
     $cinder_rbd_backend = 'tripleo_ceph'
 
-    cinder_config {
-      "${cinder_rbd_backend}/host": value => 'hostgroup';
-    }
-
     cinder::backend::rbd { $cinder_rbd_backend :
       rbd_pool        => 'volumes',
       rbd_user        => 'openstack',
       rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
-      require         => Ceph::Pool['volumes'],
+      require         => $cinder_pool_requires,
     }
   }
 
@@ -888,6 +885,8 @@ if hiera('step') >= 3 {
 } #END STEP 3
 
 if hiera('step') >= 4 {
+  include ::keystone::cron::token_flush
+
   if $pacemaker_master {
 
     # Keystone
@@ -895,6 +894,43 @@ if hiera('step') >= 4 {
       clone_params => "interleave=true",
     }
 
+    pacemaker::constraint::base { 'haproxy-then-keystone-constraint':
+      constraint_type => 'order',
+      first_resource  => "haproxy-clone",
+      second_resource => "${::keystone::params::service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service['haproxy'],
+                          Pacemaker::Resource::Service[$::keystone::params::service_name]],
+    }
+    pacemaker::constraint::base { 'rabbitmq-then-keystone-constraint':
+      constraint_type => 'order',
+      first_resource  => "rabbitmq-clone",
+      second_resource => "${::keystone::params::service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Ocf['rabbitmq'],
+                          Pacemaker::Resource::Service[$::keystone::params::service_name]],
+    }
+    pacemaker::constraint::base { 'memcached-then-keystone-constraint':
+      constraint_type => 'order',
+      first_resource  => "memcached-clone",
+      second_resource => "${::keystone::params::service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service['memcached'],
+                          Pacemaker::Resource::Service[$::keystone::params::service_name]],
+    }
+    pacemaker::constraint::base { 'galera-then-keystone-constraint':
+      constraint_type => 'order',
+      first_resource  => "galera-master",
+      second_resource => "${::keystone::params::service_name}-clone",
+      first_action    => 'promote',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Ocf['galera'],
+                          Pacemaker::Resource::Service[$::keystone::params::service_name]],
+    }
+
     # Cinder
     pacemaker::resource::service { $::cinder::params::api_service :
       clone_params => "interleave=true",
@@ -1161,24 +1197,22 @@ if hiera('step') >= 4 {
       require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
                   Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name]],
     }
-    # FIXME(gfidente): novncproxy will not start unless websockify is updated to 0.6
-    # which is not the case for f20 nor f21; ucomment when it becomes available
-    #pacemaker::constraint::base { 'nova-vncproxy-then-nova-api-constraint':
-    #  constraint_type => "order",
-    #  first_resource  => "${::nova::params::vncproxy_service_name}-clone",
-    #  second_resource => "${::nova::params::api_service_name}-clone",
-    #  first_action    => "start",
-    #  second_action   => "start",
-    #  require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
-    #              Pacemaker::Resource::Service[$::nova::params::api_service_name]],
-    #}
-    #pacemaker::constraint::colocation { 'nova-api-with-nova-vncproxy-colocation':
-    #  source => "${::nova::params::api_service_name}-clone",
-    #  target => "${::nova::params::vncproxy_service_name}-clone",
-    #  score => "INFINITY",
-    #  require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
-    #              Pacemaker::Resource::Service[$::nova::params::api_service_name]],
-    #}
+    pacemaker::constraint::base { 'nova-vncproxy-then-nova-api-constraint':
+      constraint_type => "order",
+      first_resource  => "${::nova::params::vncproxy_service_name}-clone",
+      second_resource => "${::nova::params::api_service_name}-clone",
+      first_action    => "start",
+      second_action   => "start",
+      require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
+                  Pacemaker::Resource::Service[$::nova::params::api_service_name]],
+    }
+    pacemaker::constraint::colocation { 'nova-api-with-nova-vncproxy-colocation':
+      source => "${::nova::params::api_service_name}-clone",
+      target => "${::nova::params::vncproxy_service_name}-clone",
+      score => "INFINITY",
+      require => [Pacemaker::Resource::Service[$::nova::params::vncproxy_service_name],
+                  Pacemaker::Resource::Service[$::nova::params::api_service_name]],
+    }
     pacemaker::constraint::base { 'nova-api-then-nova-scheduler-constraint':
       constraint_type => "order",
       first_resource  => "${::nova::params::api_service_name}-clone",
@@ -1238,6 +1272,22 @@ if hiera('step') >= 4 {
       clone_params    => 'interleave=true',
       resource_params => 'startdelay=10',
     }
+    # Fedora doesn't know `require-all` parameter for constraints yet
+    if $::operatingsystem == 'Fedora' {
+      $redis_ceilometer_constraint_params = undef
+    } else {
+      $redis_ceilometer_constraint_params = 'require-all=false'
+    }
+    pacemaker::constraint::base { 'redis-then-ceilometer-central-constraint':
+      constraint_type   => 'order',
+      first_resource    => "redis-master",
+      second_resource   => "${::ceilometer::params::agent_central_service_name}-clone",
+      first_action      => 'promote',
+      second_action     => 'start',
+      constraint_params => $redis_ceilometer_constraint_params,
+      require           => [Pacemaker::Resource::Ocf['redis'],
+                            Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name]],
+    }
     pacemaker::constraint::base { 'keystone-then-ceilometer-central-constraint':
       constraint_type => 'order',
       first_resource  => "${::keystone::params::service_name}-clone",
@@ -1437,3 +1487,6 @@ if hiera('step') >= 4 {
   }
 
 } #END STEP 4
+
+$package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller_pacemaker', hiera('step')])
+package_manifest{$package_manifest_name: ensure => present}