Run sync in step 3 when $sync_db
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller_pacemaker.pp
index 2be9911..0372a56 100644 (file)
@@ -18,6 +18,25 @@ Pcmk_resource <| |> {
   try_sleep => 3,
 }
 
+# TODO(jistr): use pcs resource provider instead of just no-ops
+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'
+|> {
+  hasrestart => true,
+  restart    => '/bin/true',
+  start      => '/bin/true',
+  stop       => '/bin/true',
+}
+
 include ::tripleo::packages
 include ::tripleo::firewall
 
@@ -29,13 +48,13 @@ if $::hostname == downcase(hiera('bootstrap_nodeid')) {
   $sync_db = false
 }
 
-$enable_fencing = str2bool(hiera('enable_fencing', false)) and hiera('step') >= 5
+$enable_fencing = str2bool(hiera('enable_fencing', false)) and hiera('step') >= 6
 $enable_load_balancer = hiera('enable_load_balancer', true)
 
 # When to start and enable services which haven't been Pacemakerized
 # FIXME: remove when we start all OpenStack services using Pacemaker
-# (occurences of this variable will be gradually replaced with false)
-$non_pcmk_start = hiera('step') >= 4
+# (occurrences of this variable will be gradually replaced with false)
+$non_pcmk_start = hiera('step') >= 5
 
 if hiera('step') >= 1 {
 
@@ -62,15 +81,19 @@ if hiera('step') >= 1 {
   }
 
   $pacemaker_cluster_members = downcase(regsubst(hiera('controller_node_names'), ',', ' ', 'G'))
-  user { 'hacluster':
-    ensure => present,
-  } ->
+  $corosync_ipv6 = str2bool(hiera('corosync_ipv6', false))
+  if $corosync_ipv6 {
+    $cluster_setup_extras = { '--token' => hiera('corosync_token_timeout', 1000), '--ipv6' => '' }
+  } else {
+    $cluster_setup_extras = { '--token' => hiera('corosync_token_timeout', 1000) }
+  }
   class { '::pacemaker':
     hacluster_pwd => hiera('hacluster_pwd'),
   } ->
   class { '::pacemaker::corosync':
-    cluster_members => $pacemaker_cluster_members,
-    setup_cluster   => $pacemaker_master,
+    cluster_members      => $pacemaker_cluster_members,
+    setup_cluster        => $pacemaker_master,
+    cluster_setup_extras => $cluster_setup_extras,
   }
   class { '::pacemaker::stonith':
     disable => !$enable_fencing,
@@ -93,12 +116,21 @@ if hiera('step') >= 1 {
   # 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   => hiera('rabbitmq_environment'),
+    environment_variables   => $rabbit_env,
   } ->
   file { '/var/lib/rabbitmq/.erlang.cookie':
     ensure  => file,
@@ -111,6 +143,7 @@ if hiera('step') >= 1 {
 
   if downcase(hiera('ceilometer_backend')) == 'mongodb' {
     include ::mongodb::globals
+    include ::mongodb::client
     class { '::mongodb::server' :
       service_manage => false,
     }
@@ -153,8 +186,10 @@ if hiera('step') >= 1 {
       'bind-address'                  => $::hostname,
       'max_connections'               => hiera('mysql_max_connections'),
       'open_files_limit'              => '-1',
+      'wsrep_on'                      => 'ON',
       'wsrep_provider'                => '/usr/lib64/galera/libgalera_smm.so',
       'wsrep_cluster_name'            => 'galera_cluster',
+      'wsrep_cluster_address'         => "gcomm://${galera_nodes}",
       'wsrep_slave_threads'           => '1',
       'wsrep_certify_nonPK'           => '1',
       'wsrep_max_ws_rows'             => '131072',
@@ -185,8 +220,19 @@ if hiera('step') >= 1 {
 if hiera('step') >= 2 {
 
   # NOTE(gfidente): the following vars are needed on all nodes so they
-  # need to stay out of pacemaker_master conditional
-  $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
+  # need to stay out of pacemaker_master conditional.
+  # The addresses mangling will hopefully go away when we'll be able to
+  # configure the connection string via hostnames, until then, we need to pass
+  # the list of IPv6 addresses *with* port and without the brackets as 'members'
+  # argument for the 'mongodb_replset' resource.
+  if str2bool(hiera('mongodb::server::ipv6', false)) {
+    $mongo_node_ips_with_port_prefixed = prefix(hiera('mongo_node_ips'), '[')
+    $mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
+    $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
+  } else {
+    $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
+    $mongo_node_ips_with_port_nobr = suffix(hiera('mongo_node_ips'), ':27017')
+  }
   $mongodb_replset = hiera('mongodb::server::replset')
 
   if $pacemaker_master {
@@ -195,6 +241,11 @@ if hiera('step') >= 2 {
 
       include ::pacemaker::resource_defaults
 
+      # Create an openstack-core dummy resource. See RHBZ 1290121
+      pacemaker::resource::ocf { 'openstack-core':
+        ocf_agent_name => 'heartbeat:Dummy',
+        clone_params   => true,
+      }
       # 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
@@ -204,147 +255,46 @@ if hiera('step') >= 2 {
       }
 
       $control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip')
-      pacemaker::resource::ip { 'control_vip':
+      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_control_vip':
+        vip_name   => 'control',
         ip_address => $control_vip,
       }
-      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']],
-      }
 
       $public_vip = hiera('tripleo::loadbalancer::public_virtual_ip')
-      if $public_vip and $public_vip != $control_vip {
-        pacemaker::resource::ip { 'public_vip':
-          ip_address => $public_vip,
-        }
-        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 $redis_vip and $redis_vip != $control_vip {
-        pacemaker::resource::ip { 'redis_vip':
-          ip_address => $redis_vip,
-        }
-        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 $internal_api_vip and $internal_api_vip != $control_vip {
-        pacemaker::resource::ip { 'internal_api_vip':
-          ip_address => $internal_api_vip,
-        }
-        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 $storage_vip and $storage_vip != $control_vip {
-        pacemaker::resource::ip { 'storage_vip':
-          ip_address => $storage_vip,
-        }
-        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 $storage_mgmt_vip and $storage_mgmt_vip != $control_vip {
-        pacemaker::resource::ip { 'storage_mgmt_vip':
-          ip_address => $storage_mgmt_vip,
-        }
-        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 :
@@ -374,7 +324,7 @@ if hiera('step') >= 2 {
         before  => Mongodb_replset[$mongodb_replset],
       }
       mongodb_replset { $mongodb_replset :
-        members => $mongo_node_ips_with_port,
+        members => $mongo_node_ips_with_port_nobr,
       }
     }
 
@@ -457,6 +407,11 @@ MYSQL_HOST=localhost\n",
       }
     }
 
+    if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
+      class { '::gnocchi::db::mysql':
+        require => Exec['galera-ready'],
+      }
+    }
     class { '::sahara::db::mysql':
       require       => Exec['galera-ready'],
     }
@@ -469,8 +424,15 @@ MYSQL_HOST=localhost\n",
   $enable_ceph = hiera('ceph_storage_count', 0) > 0 or hiera('enable_ceph_storage', false)
 
   if $enable_ceph {
+    $mon_initial_members = downcase(hiera('ceph_mon_initial_members'))
+    if str2bool(hiera('ceph_ipv6', false)) {
+      $mon_host = hiera('ceph_mon_host_v6')
+    } else {
+      $mon_host = hiera('ceph_mon_host')
+    }
     class { '::ceph::profile::params':
-      mon_initial_members => downcase(hiera('ceph_mon_initial_members')),
+      mon_initial_members => $mon_initial_members,
+      mon_host            => $mon_host,
     }
     include ::ceph::conf
     include ::ceph::profile::mon
@@ -496,6 +458,14 @@ MYSQL_HOST=localhost\n",
   }
 
   if str2bool(hiera('enable_external_ceph', false)) {
+    if str2bool(hiera('ceph_ipv6', false)) {
+      $mon_host = hiera('ceph_mon_host_v6')
+    } else {
+      $mon_host = hiera('ceph_mon_host')
+    }
+    class { '::ceph::profile::params':
+      mon_host            => $mon_host,
+    }
     include ::ceph::conf
     include ::ceph::profile::client
   }
@@ -503,88 +473,17 @@ MYSQL_HOST=localhost\n",
 
 } #END STEP 2
 
-if hiera('step') >= 3 {
-
-  class { '::keystone':
-    sync_db          => $sync_db,
-    manage_service   => false,
-    enabled          => false,
-    enable_bootstrap => $pacemaker_master,
-  }
-  include ::keystone::config
-
-  #TODO: need a cleanup-keystone-tokens.sh solution here
-
-  file { [ '/etc/keystone/ssl', '/etc/keystone/ssl/certs', '/etc/keystone/ssl/private' ]:
-    ensure  => 'directory',
-    owner   => 'keystone',
-    group   => 'keystone',
-    require => Package['keystone'],
-  }
-  file { '/etc/keystone/ssl/certs/signing_cert.pem':
-    content => hiera('keystone_signing_certificate'),
-    owner   => 'keystone',
-    group   => 'keystone',
-    notify  => Service['keystone'],
-    require => File['/etc/keystone/ssl/certs'],
-  }
-  file { '/etc/keystone/ssl/private/signing_key.pem':
-    content => hiera('keystone_signing_key'),
-    owner   => 'keystone',
-    group   => 'keystone',
-    notify  => Service['keystone'],
-    require => File['/etc/keystone/ssl/private'],
-  }
-  file { '/etc/keystone/ssl/certs/ca.pem':
-    content => hiera('keystone_ca_certificate'),
-    owner   => 'keystone',
-    group   => 'keystone',
-    notify  => Service['keystone'],
-    require => File['/etc/keystone/ssl/certs'],
-  }
-
-  $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)
-
-  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', '')],','),
-      clone_params => '',
-    }
-  }
-
-  # 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 join(['::glance::backend::', $glance_backend])
-  $rabbit_port = hiera('rabbitmq::port')
-  class { '::glance::notify::rabbitmq':
-    rabbit_hosts => suffix(hiera('rabbit_node_ips'), ":${rabbit_port}"),
+if hiera('step') >= 4 or ( hiera('step') >= 3 and $sync_db ) {
+
+  $nova_ipv6 = hiera('nova::use_ipv6', false)
+  if $nova_ipv6 {
+    $memcached_servers = suffix(hiera('memcache_node_ips_v6'), ':11211')
+  } else {
+    $memcached_servers = suffix(hiera('memcache_node_ips'), ':11211')
   }
 
   class { '::nova' :
-    memcached_servers => suffix(hiera('memcache_node_ips'), ':11211'),
+    memcached_servers => $memcached_servers
   }
 
   include ::nova::config
@@ -689,6 +588,14 @@ if hiera('step') >= 3 {
       keystone_password => hiera('neutron::server::auth_password')
     }
   }
+  if hiera('neutron::core_plugin') == 'networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2' {
+    class { '::neutron::plugins::plumgrid' :
+      connection                   => hiera('neutron::server::database_connection'),
+      controller_priv_host         => hiera('keystone_admin_api_vip'),
+      admin_password               => hiera('admin_password'),
+      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,
@@ -806,6 +713,7 @@ if hiera('step') >= 3 {
     $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'),
@@ -898,7 +806,7 @@ if hiera('step') >= 3 {
 
   $cinder_enabled_backends = delete_undef_values([$cinder_iscsi_backend, $cinder_rbd_backend, $cinder_eqlx_backend, $cinder_dellsc_backend, $cinder_netapp_backend, $cinder_nfs_backend])
   class { '::cinder::backends' :
-    enabled_backends => $cinder_enabled_backends,
+    enabled_backends => union($cinder_enabled_backends, hiera('cinder_user_enabled_backends')),
   }
 
   class { '::sahara':
@@ -993,6 +901,7 @@ if hiera('step') >= 3 {
     sync_db             => $sync_db,
   }
   include ::ceilometer::agent::auth
+  include ::ceilometer::dispatcher::gnocchi
 
   Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
 
@@ -1025,7 +934,7 @@ if hiera('step') >= 3 {
     service_enable => false,
     # service_manage => false, # <-- not supported with horizon&apache mod_wsgi?
   }
-  include ::keystone::wsgi::apache
+  include ::apache::mod::remoteip
   include ::apache::mod::status
   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
     $_profile_support = 'cisco'
@@ -1033,11 +942,79 @@ if hiera('step') >= 3 {
     $_profile_support = 'None'
   }
   $neutron_options   = {'profile_support' => $_profile_support }
+
+  $memcached_ipv6 = hiera('memcached_ipv6', false)
+  if $memcached_ipv6 {
+    $horizon_memcached_servers = hiera('memcache_node_ips_v6', '[::1]')
+  } else {
+    $horizon_memcached_servers = hiera('memcache_node_ips', '127.0.0.1')
+  }
+
   class { '::horizon':
-    cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
+    cache_server_ip => $horizon_memcached_servers,
     neutron_options => $neutron_options,
   }
 
+  # Aodh
+  class { '::aodh' :
+    database_connection => $ceilometer_database_connection,
+  }
+  include ::aodh::config
+  include ::aodh::auth
+  include ::aodh::client
+  include ::aodh::wsgi::apache
+  class { '::aodh::api':
+    manage_service => false,
+    enabled        => false,
+    service_name   => 'httpd',
+  }
+  class { '::aodh::evaluator':
+    manage_service => false,
+    enabled        => false,
+  }
+  class { '::aodh::notifier':
+    manage_service => false,
+    enabled        => false,
+  }
+  class { '::aodh::listener':
+    manage_service => false,
+    enabled        => false,
+  }
+
+  # Gnocchi
+  $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
+  include ::gnocchi::client
+  if $sync_db {
+    include ::gnocchi::db::sync
+  }
+  include ::gnocchi::storage
+  $gnocchi_backend = downcase(hiera('gnocchi_backend', 'swift'))
+  case $gnocchi_backend {
+      'swift': { include ::gnocchi::storage::swift }
+      'file': { include ::gnocchi::storage::file }
+      'rbd': { include ::gnocchi::storage::ceph }
+      default: { fail('Unrecognized gnocchi_backend parameter.') }
+  }
+  class { '::gnocchi':
+    database_connection => $gnocchi_database_connection,
+  }
+  class { '::gnocchi::api' :
+    manage_service => false,
+    enabled        => false,
+    service_name   => 'httpd',
+  }
+  class { '::gnocchi::wsgi::apache' :
+    ssl => false,
+  }
+  class { '::gnocchi::metricd' :
+    manage_service => false,
+    enabled        => false,
+  }
+  class { '::gnocchi::statsd' :
+    manage_service => false,
+    enabled        => false,
+  }
+
   $snmpd_user = hiera('snmpd_readonly_user_name')
   snmp::snmpv3_user { $snmpd_user:
     authtype => 'MD5',
@@ -1045,22 +1022,18 @@ if hiera('step') >= 3 {
   }
   class { '::snmp':
     agentaddress => ['udp:161','udp6:[::1]:161'],
-    snmpd_config => [ join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc  cron', 'includeAllDisks  10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ],
+    snmpd_config => [ join(['createUser ', hiera('snmpd_readonly_user_name'), ' MD5 "', hiera('snmpd_readonly_user_password'), '"']), join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc  cron', 'includeAllDisks  10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ],
   }
 
   hiera_include('controller_classes')
 
-} #END STEP 3
+} #END STEP 4
 
-if hiera('step') >= 4 {
-  $keystone_enable_db_purge = hiera('keystone_enable_db_purge', true)
+if hiera('step') >= 5 {
   $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
   $cinder_enable_db_purge = hiera('cinder_enable_db_purge', true)
   $heat_enable_db_purge = hiera('heat_enable_db_purge', true)
 
-  if $keystone_enable_db_purge {
-    include ::keystone::cron::token_flush
-  }
   if $nova_enable_db_purge {
     include ::nova::cron::archive_deleted_rows
   }
@@ -1073,49 +1046,38 @@ if hiera('step') >= 4 {
 
   if $pacemaker_master {
 
-    if $enable_load_balancer {
-      pacemaker::constraint::base { 'haproxy-then-keystone-constraint':
-        constraint_type => 'order',
-        first_resource  => 'haproxy-clone',
-        second_resource => "${::apache::params::service_name}-clone",
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Service['haproxy'],
-                            Pacemaker::Resource::Service[$::apache::params::service_name]],
-      }
-    }
-    pacemaker::constraint::base { 'rabbitmq-then-keystone-constraint':
+    pacemaker::constraint::base { 'openstack-core-then-httpd-constraint':
       constraint_type => 'order',
-      first_resource  => 'rabbitmq-clone',
+      first_resource  => 'openstack-core-clone',
       second_resource => "${::apache::params::service_name}-clone",
       first_action    => 'start',
       second_action   => 'start',
-      require         => [Pacemaker::Resource::Ocf['rabbitmq'],
-                          Pacemaker::Resource::Service[$::apache::params::service_name]],
+      require         => [Pacemaker::Resource::Service[$::apache::params::service_name],
+                          Pacemaker::Resource::Ocf['openstack-core']],
     }
-    pacemaker::constraint::base { 'memcached-then-keystone-constraint':
+    pacemaker::constraint::base { 'memcached-then-openstack-core-constraint':
       constraint_type => 'order',
       first_resource  => 'memcached-clone',
-      second_resource => "${::apache::params::service_name}-clone",
+      second_resource => 'openstack-core-clone',
       first_action    => 'start',
       second_action   => 'start',
       require         => [Pacemaker::Resource::Service['memcached'],
-                          Pacemaker::Resource::Service[$::apache::params::service_name]],
+                          Pacemaker::Resource::Ocf['openstack-core']],
     }
-    pacemaker::constraint::base { 'galera-then-keystone-constraint':
+    pacemaker::constraint::base { 'galera-then-openstack-core-constraint':
       constraint_type => 'order',
       first_resource  => 'galera-master',
-      second_resource => "${::apache::params::service_name}-clone",
+      second_resource => 'openstack-core-clone',
       first_action    => 'promote',
       second_action   => 'start',
       require         => [Pacemaker::Resource::Ocf['galera'],
-                          Pacemaker::Resource::Service[$::apache::params::service_name]],
+                          Pacemaker::Resource::Ocf['openstack-core']],
     }
 
     # Cinder
     pacemaker::resource::service { $::cinder::params::api_service :
       clone_params => 'interleave=true',
-      require      => Pacemaker::Resource::Service[$::apache::params::service_name],
+      require      => Pacemaker::Resource::Ocf['openstack-core'],
     }
     pacemaker::resource::service { $::cinder::params::scheduler_service :
       clone_params => 'interleave=true',
@@ -1124,12 +1086,12 @@ if hiera('step') >= 4 {
 
     pacemaker::constraint::base { 'keystone-then-cinder-api-constraint':
       constraint_type => 'order',
-      first_resource  => "${::apache::params::service_name}-clone",
+      first_resource  => 'openstack-core-clone',
       second_resource => "${::cinder::params::api_service}-clone",
       first_action    => 'start',
       second_action   => 'start',
-      require         => [Pacemaker::Resource::Service[$::cinder::params::api_service],
-                          Pacemaker::Resource::Service[$::apache::params::service_name]],
+      require         => [Pacemaker::Resource::Ocf['openstack-core'],
+                          Pacemaker::Resource::Service[$::cinder::params::api_service]],
     }
     pacemaker::constraint::base { 'cinder-api-then-cinder-scheduler-constraint':
       constraint_type => 'order',
@@ -1167,57 +1129,31 @@ if hiera('step') >= 4 {
     # Sahara
     pacemaker::resource::service { $::sahara::params::api_service_name :
       clone_params => 'interleave=true',
-      require      => Pacemaker::Resource::Service[$::apache::params::service_name],
+      require      => Pacemaker::Resource::Ocf['openstack-core'],
     }
     pacemaker::resource::service { $::sahara::params::engine_service_name :
       clone_params => 'interleave=true',
     }
     pacemaker::constraint::base { 'keystone-then-sahara-api-constraint':
       constraint_type => 'order',
-      first_resource  => "${::apache::params::service_name}-clone",
+      first_resource  => 'openstack-core-clone',
       second_resource => "${::sahara::params::api_service_name}-clone",
       first_action    => 'start',
       second_action   => 'start',
       require         => [Pacemaker::Resource::Service[$::sahara::params::api_service_name],
-                          Pacemaker::Resource::Service[$::apache::params::service_name]],
+                          Pacemaker::Resource::Ocf['openstack-core']],
     }
-
-    # Glance
-    pacemaker::resource::service { $::glance::params::registry_service_name :
-      clone_params => 'interleave=true',
-      require      => Pacemaker::Resource::Service[$::apache::params::service_name],
-    }
-    pacemaker::resource::service { $::glance::params::api_service_name :
-      clone_params => 'interleave=true',
-    }
-
-    pacemaker::constraint::base { 'keystone-then-glance-registry-constraint':
+    pacemaker::constraint::base { 'sahara-api-then-sahara-engine-constraint':
       constraint_type => 'order',
-      first_resource  => "${::apache::params::service_name}-clone",
-      second_resource => "${::glance::params::registry_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[$::apache::params::service_name]],
-    }
-    pacemaker::constraint::base { 'glance-registry-then-glance-api-constraint':
-      constraint_type => 'order',
-      first_resource  => "${::glance::params::registry_service_name}-clone",
-      second_resource => "${::glance::params::api_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') == 4 {
+    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
@@ -1236,12 +1172,12 @@ if hiera('step') >= 4 {
       } ->
       pacemaker::resource::service { $::neutron::params::server_service:
         clone_params => 'interleave=true',
-        require      => Pacemaker::Resource::Service[$::apache::params::service_name]
+        require      => Pacemaker::Resource::Ocf['openstack-core']
       }
     } else {
       pacemaker::resource::service { $::neutron::params::server_service:
         clone_params => 'interleave=true',
-        require      => Pacemaker::Resource::Service[$::apache::params::service_name]
+        require      => Pacemaker::Resource::Ocf['openstack-core']
       }
     }
     if hiera('neutron::enable_l3_agent', true) {
@@ -1314,14 +1250,14 @@ if hiera('step') >= 4 {
       }
     }
     pacemaker::constraint::base { 'keystone-to-neutron-server-constraint':
-      constraint_type   => 'order',
-      first_resource    => "${::apache::params::service_name}-clone",
-        second_resource => "${::neutron::params::server_service}-clone",
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Service[$::apache::params::service_name],
-                            Pacemaker::Resource::Service[$::neutron::params::server_service]],
-      }
+      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',
@@ -1352,7 +1288,7 @@ if hiera('step') >= 4 {
                     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",
@@ -1435,7 +1371,7 @@ if hiera('step') >= 4 {
     }
     pacemaker::resource::service { $::nova::params::consoleauth_service_name :
       clone_params => 'interleave=true',
-      require      => Pacemaker::Resource::Service[$::apache::params::service_name],
+      require      => Pacemaker::Resource::Ocf['openstack-core'],
     }
     pacemaker::resource::service { $::nova::params::vncproxy_service_name :
       clone_params => 'interleave=true',
@@ -1446,12 +1382,12 @@ if hiera('step') >= 4 {
 
     pacemaker::constraint::base { 'keystone-then-nova-consoleauth-constraint':
       constraint_type => 'order',
-      first_resource  => "${::apache::params::service_name}-clone",
+      first_resource  => 'openstack-core-clone',
       second_resource => "${::nova::params::consoleauth_service_name}-clone",
       first_action    => 'start',
       second_action   => 'start',
       require         => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
-                          Pacemaker::Resource::Service[$::apache::params::service_name]],
+                          Pacemaker::Resource::Ocf['openstack-core']],
     }
     pacemaker::constraint::base { 'nova-consoleauth-then-nova-vncproxy-constraint':
       constraint_type => 'order',
@@ -1518,19 +1454,19 @@ if hiera('step') >= 4 {
                   Pacemaker::Resource::Service[$::nova::params::conductor_service_name]],
     }
 
-    # Ceilometer
+    # Ceilometer and Aodh
     case downcase(hiera('ceilometer_backend')) {
       /mysql/: {
-        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name :
+        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
           clone_params => 'interleave=true',
-          require      => Pacemaker::Resource::Service[$::apache::params::service_name],
+          require      => Pacemaker::Resource::Ocf['openstack-core'],
         }
       }
       default: {
-        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name :
+        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
           clone_params => 'interleave=true',
-          require      => [Pacemaker::Resource::Service[$::apache::params::service_name],
-          Pacemaker::Resource::Service[$::mongodb::params::service_name]],
+          require      => [Pacemaker::Resource::Ocf['openstack-core'],
+                          Pacemaker::Resource::Service[$::mongodb::params::service_name]],
         }
       }
     }
@@ -1551,8 +1487,10 @@ if hiera('step') >= 4 {
     # Fedora doesn't know `require-all` parameter for constraints yet
     if $::operatingsystem == 'Fedora' {
       $redis_ceilometer_constraint_params = undef
+      $redis_aodh_constraint_params = undef
     } else {
       $redis_ceilometer_constraint_params = 'require-all=false'
+      $redis_aodh_constraint_params = 'require-all=false'
     }
     pacemaker::constraint::base { 'redis-then-ceilometer-central-constraint':
       constraint_type   => 'order',
@@ -1564,14 +1502,33 @@ if hiera('step') >= 4 {
       require           => [Pacemaker::Resource::Ocf['redis'],
                             Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name]],
     }
+    pacemaker::constraint::base { 'redis-then-aodh-evaluator-constraint':
+      constraint_type   => 'order',
+      first_resource    => 'redis-master',
+      second_resource   => "${::aodh::params::evaluator_service_name}-clone",
+      first_action      => 'promote',
+      second_action     => 'start',
+      constraint_params => $redis_aodh_constraint_params,
+      require           => [Pacemaker::Resource::Ocf['redis'],
+                            Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name]],
+    }
     pacemaker::constraint::base { 'keystone-then-ceilometer-central-constraint':
       constraint_type => 'order',
-      first_resource  => "${::apache::params::service_name}-clone",
+      first_resource  => 'openstack-core-clone',
       second_resource => "${::ceilometer::params::agent_central_service_name}-clone",
       first_action    => 'start',
       second_action   => 'start',
       require         => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
-                          Pacemaker::Resource::Service[$::apache::params::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',
@@ -1614,6 +1571,64 @@ if hiera('step') >= 4 {
       require => [Pacemaker::Resource::Service[$::ceilometer::params::api_service_name],
                   Pacemaker::Resource::Ocf['delay']],
     }
+    # Aodh
+    pacemaker::resource::service { $::aodh::params::evaluator_service_name :
+      clone_params => 'interleave=true',
+    }
+    pacemaker::resource::service { $::aodh::params::notifier_service_name :
+      clone_params => 'interleave=true',
+    }
+    pacemaker::resource::service { $::aodh::params::listener_service_name :
+      clone_params => 'interleave=true',
+    }
+    pacemaker::constraint::base { 'aodh-delay-then-aodh-evaluator-constraint':
+      constraint_type => 'order',
+      first_resource  => 'delay-clone',
+      second_resource => "${::aodh::params::evaluator_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
+                          Pacemaker::Resource::Ocf['delay']],
+    }
+    pacemaker::constraint::colocation { 'aodh-evaluator-with-aodh-delay-colocation':
+      source  => "${::aodh::params::evaluator_service_name}-clone",
+      target  => 'delay-clone',
+      score   => 'INFINITY',
+      require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
+                  Pacemaker::Resource::Ocf['delay']],
+    }
+    pacemaker::constraint::base { 'aodh-evaluator-then-aodh-notifier-constraint':
+      constraint_type => 'order',
+      first_resource  => "${::aodh::params::evaluator_service_name}-clone",
+      second_resource => "${::aodh::params::notifier_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
+                          Pacemaker::Resource::Service[$::aodh::params::notifier_service_name]],
+    }
+    pacemaker::constraint::colocation { 'aodh-notifier-with-aodh-evaluator-colocation':
+      source  => "${::aodh::params::notifier_service_name}-clone",
+      target  => "${::aodh::params::evaluator_service_name}-clone",
+      score   => 'INFINITY',
+      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",
+      score   => 'INFINITY',
+      require => [Pacemaker::Resource::Service[$::aodh::params::evaluator_service_name],
+                  Pacemaker::Resource::Service[$::aodh::params::listener_service_name]],
+    }
     if downcase(hiera('ceilometer_backend')) == 'mongodb' {
       pacemaker::constraint::base { 'mongodb-then-ceilometer-central-constraint':
         constraint_type => 'order',
@@ -1626,6 +1641,30 @@ if hiera('step') >= 4 {
       }
     }
 
+    # gnocchi
+    pacemaker::resource::service { $::gnocchi::params::metricd_service_name :
+      clone_params => 'interleave=true',
+    }
+    pacemaker::resource::service { $::gnocchi::params::statsd_service_name :
+      clone_params => 'interleave=true',
+    }
+    pacemaker::constraint::base { 'gnocchi-metricd-then-gnocchi-statsd-constraint':
+      constraint_type => 'order',
+      first_resource  => "${::gnocchi::params::metricd_service_name}-clone",
+      second_resource => "${::gnocchi::params::statsd_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::gnocchi::params::metricd_service_name],
+                          Pacemaker::Resource::Service[$::gnocchi::params::statsd_service_name]],
+    }
+    pacemaker::constraint::colocation { 'gnocchi-statsd-with-metricd-colocation':
+      source  => "${::gnocchi::params::statsd_service_name}-clone",
+      target  => "${::gnocchi::params::metricd_service_name}-clone",
+      score   => 'INFINITY',
+      require => [Pacemaker::Resource::Service[$::gnocchi::params::metricd_service_name],
+                  Pacemaker::Resource::Service[$::gnocchi::params::statsd_service_name]],
+    }
+
     # Heat
     pacemaker::resource::service { $::heat::params::api_service_name :
       clone_params => 'interleave=true',
@@ -1639,15 +1678,6 @@ if hiera('step') >= 4 {
     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  => "${::apache::params::service_name}-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::Service[$::apache::params::service_name]],
-    }
     pacemaker::constraint::base { 'heat-api-then-heat-api-cfn-constraint':
       constraint_type => 'order',
       first_resource  => "${::heat::params::api_service_name}-clone",
@@ -1742,20 +1772,6 @@ if hiera('step') >= 4 {
 
   }
 
-} #END STEP 4
-
-if hiera('step') >= 5 {
-
-  if $pacemaker_master {
-
-    class {'::keystone::roles::admin' :
-      require => Pacemaker::Resource::Service[$::apache::params::service_name],
-    } ->
-    class {'::keystone::endpoint' :
-      require => Pacemaker::Resource::Service[$::apache::params::service_name],
-    }
-  }
-
 } #END STEP 5
 
 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller_pacemaker', hiera('step')])