Merge "Align template defaults with the client"
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller.pp
index f5b69f7..508025c 100644 (file)
 # License for the specific language governing permissions and limitations
 # under the License.
 
-include tripleo::packages
+include ::tripleo::packages
+include ::tripleo::firewall
+
+$enable_load_balancer = hiera('enable_load_balancer', true)
 
 if hiera('step') >= 1 {
 
@@ -21,9 +24,11 @@ if hiera('step') >= 1 {
 
   $controller_node_ips = split(hiera('controller_node_ips'), ',')
 
-  class { '::tripleo::loadbalancer' :
-    controller_hosts => $controller_node_ips,
-    manage_vip       => true,
+  if $enable_load_balancer {
+    class { '::tripleo::loadbalancer' :
+      controller_hosts => $controller_node_ips,
+      manage_vip       => true,
+    }
   }
 
 }
@@ -70,18 +75,18 @@ if hiera('step') >= 2 {
     include ::tripleo::redis_notification
   }
 
-  if str2bool(hiera('enable_galera', 'true')) {
+  if str2bool(hiera('enable_galera', true)) {
     $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
   } else {
     $mysql_config_file = '/etc/my.cnf.d/server.cnf'
   }
   # TODO Galara
-  class { 'mysql::server':
-    config_file => $mysql_config_file,
-    override_options => {
+  class { '::mysql::server':
+    config_file             => $mysql_config_file,
+    override_options        => {
       'mysqld' => {
-        'bind-address' => hiera('mysql_bind_host'),
-        'max_connections' => hiera('mysql_max_connections'),
+        'bind-address'     => hiera('mysql_bind_host'),
+        'max_connections'  => hiera('mysql_max_connections'),
         'open_files_limit' => '-1',
       },
     },
@@ -126,31 +131,31 @@ if hiera('step') >= 2 {
   $enable_ceph = hiera('ceph_storage_count', 0) > 0
 
   if $enable_ceph {
-    class { 'ceph::profile::params':
-      mon_initial_members => downcase(hiera('ceph_mon_initial_members'))
+    class { '::ceph::profile::params':
+      mon_initial_members => downcase(hiera('ceph_mon_initial_members')),
     }
     include ::ceph::profile::mon
   }
 
-  if str2bool(hiera('enable_ceph_storage', 'false')) {
+  if str2bool(hiera('enable_ceph_storage', false)) {
     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"],
+        path    => ['/usr/bin', '/usr/sbin'],
       }
 
       exec { 'set selinux to permissive':
-        command => "setenforce 0",
+        command => 'setenforce 0',
         onlyif  => "which setenforce && getenforce | grep -i 'enforcing'",
-        path    => ["/usr/bin", "/usr/sbin"],
+        path    => ['/usr/bin', '/usr/sbin'],
       } -> Class['ceph::profile::osd']
     }
 
     include ::ceph::profile::osd
   }
 
-  if str2bool(hiera('enable_external_ceph', 'false')) {
+  if str2bool(hiera('enable_external_ceph', false)) {
     include ::ceph::profile::client
   }
 
@@ -196,9 +201,9 @@ if hiera('step') >= 3 {
 
   $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' }
+      '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']
@@ -206,8 +211,8 @@ if hiera('step') >= 3 {
 
   # TODO: notifications, scrubber, etc.
   include ::glance
-  class { 'glance::api':
-    known_stores => $glance_store
+  class { '::glance::api':
+    known_stores => $glance_store,
   }
   include ::glance::registry
   include join(['::glance::backend::', $glance_backend])
@@ -225,73 +230,136 @@ if hiera('step') >= 3 {
   include ::nova::scheduler
   include ::nova::scheduler::filter
 
-  include ::neutron
-  include ::neutron::server
-  include ::neutron::agents::l3
-  include ::neutron::agents::dhcp
-  include ::neutron::agents::metadata
+  if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
 
-  file { '/etc/neutron/dnsmasq-neutron.conf':
-    content => hiera('neutron_dnsmasq_options'),
-    owner   => 'neutron',
-    group   => 'neutron',
-    notify  => Service['neutron-dhcp-service'],
-    require => Package['neutron'],
-  }
+    # TODO(devvesa) provide non-controller ips for these services
+    $zookeeper_node_ips = hiera('neutron_api_node_ips')
+    $cassandra_node_ips = hiera('neutron_api_node_ips')
 
-  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':
-    bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
-    tunnel_types => split(hiera('neutron_tunnel_types'), ','),
-  }
-  if 'cisco_n1kv' in hiera('neutron_mechanism_drivers') {
-    include neutron::plugins::ml2::cisco::nexus1000v
+    # Run zookeeper in the controller if configured
+    if hiera('enable_zookeeper_on_controller') {
+      class {'::tripleo::cluster::zookeeper':
+        zookeeper_server_ips => $zookeeper_node_ips,
+        zookeeper_client_ip  => $ipaddress,
+        zookeeper_hostnames  => hiera('controller_node_names')
+      }
+    }
 
-    class { 'neutron::agents::n1kv_vem':
-      n1kv_source          => hiera('n1kv_vem_source', undef),
-      n1kv_version         => hiera('n1kv_vem_version', undef),
+    # Run cassandra in the controller if configured
+    if hiera('enable_cassandra_on_controller') {
+      class {'::tripleo::cluster::cassandra':
+        cassandra_servers => $cassandra_node_ips,
+        cassandra_ip      => $ipaddress
+      }
     }
 
-    class { 'n1k_vsm':
-      n1kv_source       => hiera('n1kv_vsm_source', undef),
-      n1kv_version      => hiera('n1kv_vsm_version', undef),
-      pacemaker_control => false,
+    class {'::tripleo::network::midonet::agent':
+      zookeeper_servers => $zookeeper_node_ips,
+      cassandra_seeds   => $cassandra_node_ips
     }
-  }
 
-  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
-  }
+    class {'::tripleo::network::midonet::api':
+      zookeeper_servers    => $zookeeper_node_ips,
+      vip                  => $ipaddress,
+      keystone_ip          => $ipaddress,
+      keystone_admin_token => hiera('keystone::admin_token'),
+      bind_address         => $ipaddress,
+      admin_password       => hiera('admin_password')
+    }
+
+    # TODO: find a way to get an empty list from hiera
+    class {'::neutron':
+      service_plugins => []
+    }
 
-  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);
+  else {
+
+    # ML2 plugin
+    include ::neutron
   }
 
-  Service['neutron-server'] -> Service['neutron-dhcp-service']
-  Service['neutron-server'] -> Service['neutron-l3']
-  Service['neutron-server'] -> Service['neutron-ovs-agent-service']
-  Service['neutron-server'] -> Service['neutron-metadata']
+  include ::neutron::server
+  include ::neutron::server::notifications
+
+  # If the value of core plugin is set to 'nuage',
+  # include nuage core plugin, and it does not
+  # need the l3, dhcp and metadata agents
+  if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
+    include ::neutron::plugins::nuage
+  } 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'],
+    }
+
+    # If the value of core plugin is set to 'midonet',
+    # skip all the ML2 configuration
+    if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
+
+      class {'::neutron::plugins::midonet':
+        midonet_api_ip    => $ipaddress,
+        keystone_tenant   => hiera('neutron::server::auth_tenant'),
+        keystone_password => hiera('neutron::server::auth_password')
+      }
+    } else {
+
+      include ::neutron::plugins::ml2
+      include ::neutron::agents::ml2::ovs
+
+      if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
+        include ::neutron::plugins::ml2::cisco::nexus1000v
+
+        class { '::neutron::agents::n1kv_vem':
+          n1kv_source  => hiera('n1kv_vem_source', undef),
+          n1kv_version => hiera('n1kv_vem_version', undef),
+        }
+
+        class { '::n1k_vsm':
+          n1kv_source       => hiera('n1kv_vsm_source', undef),
+          n1kv_version      => hiera('n1kv_vsm_version', undef),
+          pacemaker_control => false,
+        }
+      }
+
+      if 'cisco_ucsm' in hiera('neutron::plugins::ml2::mechanism_drivers') {
+        include ::neutron::plugins::ml2::cisco::ucsm
+      }
+      if 'cisco_nexus' in hiera('neutron::plugins::ml2::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);
+      }
+      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']
+  }
 
   include ::cinder
   include ::cinder::api
   include ::cinder::glance
   include ::cinder::scheduler
   include ::cinder::volume
-  class {'cinder::setup_test_volume':
+  class { '::cinder::setup_test_volume':
     size => join([hiera('cinder_lvm_loop_device_size'), 'M']),
   }
 
@@ -307,15 +375,13 @@ if hiera('step') >= 3 {
 
   if $enable_ceph {
 
-    Ceph_pool {
+    $ceph_pools = hiera('ceph_pools')
+    ceph::pool { $ceph_pools :
       pg_num  => hiera('ceph::profile::params::osd_pool_default_pg_num'),
       pgp_num => hiera('ceph::profile::params::osd_pool_default_pgp_num'),
       size    => hiera('ceph::profile::params::osd_pool_default_size'),
     }
 
-    $ceph_pools = hiera('ceph_pools')
-    ceph::pool { $ceph_pools : }
-
     $cinder_pool_requires = [Ceph::Pool[hiera('cinder_rbd_pool_name')]]
 
   } else {
@@ -327,7 +393,7 @@ if hiera('step') >= 3 {
 
     cinder::backend::rbd { $cinder_rbd_backend :
       rbd_pool        => hiera('cinder_rbd_pool_name'),
-      rbd_user        => 'openstack',
+      rbd_user        => hiera('ceph_client_user_name'),
       rbd_secret_uuid => hiera('ceph::profile::params::fsid'),
       require         => $cinder_pool_requires,
     }
@@ -371,18 +437,18 @@ if hiera('step') >= 3 {
   if hiera('cinder_enable_nfs_backend', false) {
     $cinder_nfs_backend = 'tripleo_nfs'
 
-    if ($::selinux != "false") {
+    if str2bool($::selinux) {
       selboolean { 'virt_use_nfs':
-          value => on,
-          persistent => true,
+        value      => on,
+        persistent => true,
       } -> Package['nfs-utils']
     }
 
     package {'nfs-utils': } ->
     cinder::backend::nfs { $cinder_nfs_backend :
-      nfs_servers         => hiera('cinder_nfs_servers'),
-      nfs_mount_options   => hiera('cinder_nfs_mount_options'),
-      nfs_shares_config   => '/etc/cinder/shares-nfs.conf',
+      nfs_servers       => hiera('cinder_nfs_servers'),
+      nfs_mount_options => hiera('cinder_nfs_mount_options',''),
+      nfs_shares_config => '/etc/cinder/shares-nfs.conf',
     }
   }
 
@@ -406,9 +472,9 @@ if hiera('step') >= 3 {
   include ::swift::proxy::formpost
 
   # swift storage
-  if str2bool(hiera('enable_swift_storage', 'true')) {
-    class {'swift::storage::all':
-      mount_check => str2bool(hiera('swift_mount_check'))
+  if str2bool(hiera('enable_swift_storage', true)) {
+    class { '::swift::storage::all':
+      mount_check => str2bool(hiera('swift_mount_check')),
     }
     if(!defined(File['/srv/node'])) {
       file { '/srv/node':
@@ -438,11 +504,9 @@ if hiera('step') >= 3 {
   include ::ceilometer::api
   include ::ceilometer::agent::notification
   include ::ceilometer::agent::central
-  include ::ceilometer::alarm::notifier
-  include ::ceilometer::alarm::evaluator
   include ::ceilometer::expirer
   include ::ceilometer::collector
-  include ceilometer::agent::auth
+  include ::ceilometer::agent::auth
   class { '::ceilometer::db' :
     database_connection => $ceilometer_database_connection,
   }
@@ -457,15 +521,16 @@ if hiera('step') >= 3 {
   include ::heat::engine
 
   # Horizon
-  if 'cisco_n1kv' in hiera('neutron_mechanism_drivers') {
+  if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
     $_profile_support = 'cisco'
   } else {
     $_profile_support = 'None'
   }
   $neutron_options   = {'profile_support' => $_profile_support }
-  class { 'horizon':
-    cache_server_ip    => hiera('memcache_node_ips', '127.0.0.1'),
-    neutron_options    => $neutron_options,
+
+  class { '::horizon':
+    cache_server_ip => hiera('memcache_node_ips', '127.0.0.1'),
+    neutron_options => $neutron_options,
   }
 
   $snmpd_user = hiera('snmpd_readonly_user_name')
@@ -473,7 +538,7 @@ if hiera('step') >= 3 {
     authtype => 'MD5',
     authpass => hiera('snmpd_readonly_user_password'),
   }
-  class { 'snmp':
+  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' ],
   }
@@ -483,16 +548,12 @@ if hiera('step') >= 3 {
 } #END STEP 3
 
 if hiera('step') >= 4 {
-  include ::keystone::cron::token_flush
-
-  include ::ceilometer::keystone::auth
-  include ::cinder::keystone::auth
-  include ::glance::keystone::auth
-  include ::heat::keystone::auth
-  include ::neutron::keystone::auth
-  include ::nova::keystone::auth
-  include ::swift::keystone::auth
+  $nova_enable_db_purge = hiera('nova_enable_db_purge', true)
 
+  include ::keystone::cron::token_flush
+  if $nova_enable_db_purge {
+    include ::nova::cron::archive_deleted_rows
+  }
 } #END STEP 4
 
 $package_manifest_name = join(['/var/lib/tripleo/installed-packages/overcloud_controller', hiera('step')])