Merge "Optimize Nova disk_cachemodes and hw_disk_discard options for RBD"
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller.pp
index ecab5b5..9a2249d 100644 (file)
@@ -24,15 +24,6 @@ if hiera('step') >= 1 {
   create_resources(sysctl::value, hiera('sysctl_settings'), {})
   Exec <| tag == 'kmod::load' |>  -> Sysctl <| |>
 
-  $controller_node_ips = split(hiera('controller_node_ips'), ',')
-
-  if $enable_load_balancer {
-    class { '::tripleo::loadbalancer' :
-      controller_hosts => $controller_node_ips,
-      manage_vip       => true,
-    }
-  }
-
 }
 
 if hiera('step') >= 2 {
@@ -46,16 +37,26 @@ if hiera('step') >= 2 {
   # MongoDB
   if downcase(hiera('ceilometer_backend')) == 'mongodb' {
     include ::mongodb::globals
-
+    include ::mongodb::client
     include ::mongodb::server
-    $mongo_node_ips_with_port = suffix(hiera('mongo_node_ips'), ':27017')
+    # NOTE(gfidente): 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')
+    }
     $mongo_node_string = join($mongo_node_ips_with_port, ',')
 
     $mongodb_replset = hiera('mongodb::server::replset')
     $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}"
     if downcase(hiera('bootstrap_nodeid')) == $::hostname {
       mongodb_replset { $mongodb_replset :
-        members => $mongo_node_ips_with_port,
+        members => $mongo_node_ips_with_port_nobr,
       }
     }
   }
@@ -103,46 +104,18 @@ if hiera('step') >= 2 {
 
   # FIXME: this should only occur on the bootstrap host (ditto for db syncs)
   # Create all the database schemas
-  include ::keystone::db::mysql
-  include ::glance::db::mysql
   include ::nova::db::mysql
   include ::nova::db::mysql_api
   include ::neutron::db::mysql
   include ::cinder::db::mysql
   include ::heat::db::mysql
   include ::sahara::db::mysql
+  if downcase(hiera('gnocchi_indexer_backend')) == 'mysql' {
+    include ::gnocchi::db::mysql
+  }
   if downcase(hiera('ceilometer_backend')) == 'mysql' {
     include ::ceilometer::db::mysql
-  }
-
-  $rabbit_nodes = hiera('rabbit_node_ips')
-  if count($rabbit_nodes) > 1 {
-
-    $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':
-      config_cluster          => true,
-      cluster_nodes           => $rabbit_nodes,
-      tcp_keepalive           => false,
-      config_kernel_variables => hiera('rabbitmq_kernel_variables'),
-      config_variables        => hiera('rabbitmq_config_variables'),
-      environment_variables   => $rabbit_env,
-    }
-    rabbitmq_policy { 'ha-all@/':
-      pattern    => '^(?!amq\.).*',
-      definition => {
-        'ha-mode' => 'all',
-      },
-    }
-  } else {
-    include ::rabbitmq
+    include ::aodh::db::mysql
   }
 
   # pre-install swift here so we can build rings
@@ -151,8 +124,15 @@ if hiera('step') >= 2 {
   $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
@@ -178,72 +158,31 @@ if hiera('step') >= 2 {
   }
 
   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
   }
 
 } #END STEP 2
 
-if hiera('step') >= 3 {
-
-  include ::keystone
-  include ::keystone::config
-  include ::keystone::roles::admin
-  include ::keystone::endpoint
-  include ::keystone::wsgi::apache
-
-  #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)
-
-  # TODO: scrubber and other additional optional features
-  include ::glance
-  include ::glance::config
-  class { '::glance::api':
-    known_stores => $glance_store,
-  }
-  include ::glance::registry
-  include ::glance::notify::rabbitmq
-  include join(['::glance::backend::', $glance_backend])
+if hiera('step') >= 4 {
+
+  $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
   include ::nova::api
@@ -311,25 +250,22 @@ if hiera('step') >= 3 {
   include ::neutron::server
   include ::neutron::server::notifications
 
-  # If the value of core plugin is set to 'nuage' or 'opencontrail',
-  # include nuage or opencontrail core plugins, and it does not
-  # need the l3, dhcp and metadata agents
+  # If the value of core plugin is set to 'nuage' or'opencontrail' or 'plumgrid',
+  # include nuage or opencontrail or plumgrid core plugins
+  # else use the default value of 'ml2'
   if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
     include ::neutron::plugins::nuage
   } elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
     include ::neutron::plugins::opencontrail
-  } else {
-    include ::neutron::agents::l3
-    include ::neutron::agents::dhcp
-    include ::neutron::agents::metadata
-
-    file { '/etc/neutron/dnsmasq-neutron.conf':
-      content => hiera('neutron_dnsmasq_options'),
-      owner   => 'neutron',
-      group   => 'neutron',
-      notify  => Service['neutron-dhcp-service'],
-      require => Package['neutron'],
+  }
+  elsif 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'),
     }
+  } else {
 
     # If the value of core plugin is set to 'midonet',
     # skip all the ML2 configuration
@@ -372,17 +308,9 @@ if hiera('step') >= 3 {
         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);
-      }
       Service['neutron-server'] -> Service['neutron-ovs-agent-service']
     }
 
-    Service['neutron-server'] -> Service['neutron-dhcp-service']
-    Service['neutron-server'] -> Service['neutron-l3']
     Service['neutron-server'] -> Service['neutron-metadata']
   }
 
@@ -427,6 +355,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'),
@@ -523,7 +452,6 @@ if hiera('step') >= 3 {
   }
 
   # swift proxy
-  include ::memcached
   include ::swift::proxy
   include ::swift::proxy::proxy_logging
   include ::swift::proxy::healthcheck
@@ -572,12 +500,28 @@ if hiera('step') >= 3 {
   include ::ceilometer::expirer
   include ::ceilometer::collector
   include ::ceilometer::agent::auth
+  include ::ceilometer::dispatcher::gnocchi
   class { '::ceilometer::db' :
     database_connection => $ceilometer_database_connection,
   }
 
   Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
 
+  # Aodh
+  class { '::aodh' :
+    database_connection => $ceilometer_database_connection,
+  }
+  include ::aodh::db::sync
+  # To manage the upgrade:
+  Exec['ceilometer-dbsync'] -> Exec['aodh-db-sync']
+  include ::aodh::auth
+  include ::aodh::api
+  include ::aodh::wsgi::apache
+  include ::aodh::evaluator
+  include ::aodh::notifier
+  include ::aodh::listener
+  include ::aodh::client
+
   # Heat
   class { '::heat' :
     notification_driver => 'messaging',
@@ -594,6 +538,7 @@ if hiera('step') >= 3 {
   include ::sahara::service::engine
 
   # Horizon
+  include ::apache::mod::remoteip
   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
     $_profile_support = 'cisco'
   } else {
@@ -601,11 +546,38 @@ if hiera('step') >= 3 {
   }
   $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,
   }
 
+  # Gnocchi
+  $gnocchi_database_connection = hiera('gnocchi_mysql_conn_string')
+  class { '::gnocchi':
+    database_connection => $gnocchi_database_connection,
+  }
+  include ::gnocchi::api
+  include ::gnocchi::wsgi::apache
+  include ::gnocchi::client
+  include ::gnocchi::db::sync
+  include ::gnocchi::storage
+  include ::gnocchi::metricd
+  include ::gnocchi::statsd
+  $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.') }
+  }
+
   $snmpd_user = hiera('snmpd_readonly_user_name')
   snmp::snmpv3_user { $snmpd_user:
     authtype => 'MD5',
@@ -618,17 +590,13 @@ if hiera('step') >= 3 {
 
   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
   }
@@ -638,7 +606,23 @@ if hiera('step') >= 4 {
   if $heat_enable_db_purge {
     include ::heat::cron::purge_deleted
   }
-} #END STEP 4
+
+  if downcase(hiera('bootstrap_nodeid')) == $::hostname {
+    # Class ::heat::keystone::domain has to run on bootstrap node
+    # because it creates DB entities via API calls.
+    include ::heat::keystone::domain
+
+    Class['::keystone::roles::admin'] -> Class['::heat::keystone::domain']
+  } else {
+    # On non-bootstrap node we don't need to create Keystone resources again
+    class { '::heat::keystone::domain':
+      manage_domain => false,
+      manage_user   => false,
+      manage_role   => false,
+    }
+  }
+
+} #END STEP 5
 
 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])
 package_manifest{$package_manifest_name: ensure => present}