Switch Ceph Monitor/OSD/Client/External to composable roles
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_controller_pacemaker.pp
index 10f0398..7205002 100644 (file)
@@ -57,12 +57,6 @@ if hiera('step') >= 1 {
   create_resources(sysctl::value, hiera('sysctl_settings'), {})
   Exec <| tag == 'kmod::load' |>  -> Sysctl <| |>
 
-  include ::timezone
-
-  if count(hiera('ntp::servers')) > 0 {
-    include ::ntp
-  }
-
   $pacemaker_cluster_members = downcase(regsubst(hiera('controller_node_names'), ',', ' ', 'G'))
   $corosync_ipv6 = str2bool(hiera('corosync_ipv6', false))
   if $corosync_ipv6 {
@@ -100,11 +94,7 @@ if hiera('step') >= 1 {
   }
 
   if downcase(hiera('ceilometer_backend')) == 'mongodb' {
-    include ::mongodb::globals
-    include ::mongodb::client
-    class { '::mongodb::server' :
-      service_manage => false,
-    }
+    include ::mongodb::params
   }
 
   # Galera
@@ -166,6 +156,7 @@ 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.
   # The addresses mangling will hopefully go away when we'll be able to
@@ -192,24 +183,6 @@ if hiera('step') >= 2 {
       clone_params   => true,
     }
 
-    if downcase(hiera('ceilometer_backend')) == 'mongodb' {
-      pacemaker::resource::service { $::mongodb::params::service_name :
-        op_params    => 'start timeout=370s stop timeout=200s',
-        clone_params => true,
-        require      => Class['::mongodb::server'],
-      }
-      # NOTE (spredzy) : The replset can only be run
-      # once all the nodes have joined the cluster.
-      mongodb_conn_validator { $mongo_node_ips_with_port :
-        timeout => '600',
-        require => Pacemaker::Resource::Service[$::mongodb::params::service_name],
-        before  => Mongodb_replset[$mongodb_replset],
-      }
-      mongodb_replset { $mongodb_replset :
-        members => $mongo_node_ips_with_port_nobr,
-      }
-    }
-
     pacemaker::resource::ocf { 'galera' :
       ocf_agent_name  => 'heartbeat:galera',
       op_params       => 'promote timeout=300s on-fail=block',
@@ -272,16 +245,6 @@ if hiera('step') >= 2 {
 
   # Create all the database schemas
   if $sync_db {
-    class { '::nova::db::mysql':
-      require => Exec['galera-ready'],
-    }
-    class { '::nova::db::mysql_api':
-      require => Exec['galera-ready'],
-    }
-    class { '::neutron::db::mysql':
-      require => Exec['galera-ready'],
-    }
-
     if downcase(hiera('ceilometer_backend')) == 'mysql' {
       class { '::ceilometer::db::mysql':
         require => Exec['galera-ready'],
@@ -293,59 +256,12 @@ if hiera('step') >= 2 {
         require => Exec['galera-ready'],
       }
     }
-  }
-
-  # Ceph
-  $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 => $mon_initial_members,
-      mon_host            => $mon_host,
-    }
-    include ::ceph::conf
-    include ::ceph::profile::mon
-  }
 
-  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'],
+    class { '::aodh::db::mysql':
+        require => Exec['galera-ready'],
       }
-
-      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::conf
-    include ::ceph::profile::osd
-  }
-
-  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') >= 4 or ( hiera('step') >= 3 and $sync_db ) {
@@ -374,31 +290,6 @@ MYSQL_HOST=localhost\n",
 
   include ::nova::config
 
-  class { '::nova::api' :
-    sync_db        => $sync_db,
-    sync_db_api    => $sync_db,
-    manage_service => false,
-    enabled        => false,
-  }
-  class { '::nova::cert' :
-    manage_service => false,
-    enabled        => false,
-  }
-  class { '::nova::consoleauth' :
-    manage_service => false,
-    enabled        => false,
-  }
-  class { '::nova::vncproxy' :
-    manage_service => false,
-    enabled        => false,
-  }
-  include ::nova::scheduler::filter
-  class { '::nova::scheduler' :
-    manage_service => false,
-    enabled        => false,
-  }
-  include ::nova::network::neutron
-
   if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
 
     # TODO(devvesa) provide non-controller ips for these services
@@ -440,29 +331,14 @@ MYSQL_HOST=localhost\n",
     }
 
     # Configure Neutron
+    # TODO: when doing the composable midonet plugin, don't forget to
+    # set service_plugins to an empty array in Hiera.
     class {'::neutron':
       service_plugins => []
     }
 
   }
-  else {
-    # Neutron class definitions
-    include ::neutron
-  }
 
-  include ::neutron::config
-  class { '::neutron::server' :
-    sync_db        => $sync_db,
-    manage_service => false,
-    enabled        => false,
-  }
-  include ::neutron::server::notifications
-  if  hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
-    include ::neutron::plugins::nuage
-  }
-  if  hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
-    include ::neutron::plugins::opencontrail
-  }
   if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
     class {'::neutron::plugins::midonet':
       midonet_api_ip    => hiera('public_virtual_ip'),
@@ -470,84 +346,6 @@ MYSQL_HOST=localhost\n",
       keystone_password => hiera('neutron::server::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'),
-    }
-  }
-  include ::neutron::plugins::ml2
-  class { '::neutron::agents::ml2::ovs':
-    manage_service => false,
-    enabled        => 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 '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),
-    }
-  }
-
-  if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
-    include ::neutron::plugins::ml2::bigswitch::restproxy
-    include ::neutron::agents::bigswitch
-  }
-
-  if $enable_ceph {
-    $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'),
-    }
-  }
-
-  # swift storage
-  if str2bool(hiera('enable_swift_storage', true)) {
-    class {'::swift::storage::all':
-      mount_check => str2bool(hiera('swift_mount_check')),
-    }
-    class {'::swift::storage::account':
-      manage_service => $non_pcmk_start,
-      enabled        => $non_pcmk_start,
-    }
-    class {'::swift::storage::container':
-      manage_service => $non_pcmk_start,
-      enabled        => $non_pcmk_start,
-    }
-    class {'::swift::storage::object':
-      manage_service => $non_pcmk_start,
-      enabled        => $non_pcmk_start,
-    }
-    if(!defined(File['/srv/node'])) {
-      file { '/srv/node':
-        ensure  => directory,
-        owner   => 'swift',
-        group   => 'swift',
-        require => Package['openstack-swift'],
-      }
-    }
-    $swift_components = ['account', 'container', 'object']
-    swift::storage::filter::recon { $swift_components : }
-    swift::storage::filter::healthcheck { $swift_components : }
-  }
 
   # Ceilometer
   case downcase(hiera('ceilometer_backend')) {
@@ -616,7 +414,7 @@ MYSQL_HOST=localhost\n",
 
   # Aodh
   class { '::aodh' :
-    database_connection => $ceilometer_database_connection,
+    database_connection => hiera('aodh_mysql_conn_string'),
   }
   include ::aodh::config
   include ::aodh::auth
@@ -674,16 +472,6 @@ MYSQL_HOST=localhost\n",
     enabled        => false,
   }
 
-  $snmpd_user = hiera('snmpd_readonly_user_name')
-  snmp::snmpv3_user { $snmpd_user:
-    authtype => 'MD5',
-    authpass => hiera('snmpd_readonly_user_password'),
-  }
-  class { '::snmp':
-    agentaddress => ['udp:161','udp6:[::1]:161'],
-    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 4
@@ -739,60 +527,11 @@ password=\"${mysql_root_password}\"",
                           Pacemaker::Resource::Ocf['openstack-core']],
     }
 
-    if hiera('neutron::enable_ovs_agent', true) {
-      pacemaker::resource::service { $::neutron::params::ovs_agent_service:
-        clone_params => 'interleave=true',
-      }
-    }
     if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
       pacemaker::resource::service {'tomcat':
         clone_params => 'interleave=true',
       }
     }
-    if hiera('neutron::enable_ovs_agent', true) {
-      pacemaker::resource::ocf { $::neutron::params::ovs_cleanup_service:
-        ocf_agent_name => 'neutron:OVSCleanup',
-        clone_params   => 'interleave=true',
-      }
-      pacemaker::resource::ocf { 'neutron-netns-cleanup':
-        ocf_agent_name => 'neutron:NetnsCleanup',
-        clone_params   => 'interleave=true',
-      }
-
-      # neutron - one chain ovs-cleanup-->netns-cleanup-->ovs-agent
-      pacemaker::constraint::base { 'neutron-ovs-cleanup-to-netns-cleanup-constraint':
-        constraint_type => 'order',
-        first_resource  => "${::neutron::params::ovs_cleanup_service}-clone",
-        second_resource => 'neutron-netns-cleanup-clone',
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Ocf[$::neutron::params::ovs_cleanup_service],
-                            Pacemaker::Resource::Ocf['neutron-netns-cleanup']],
-      }
-      pacemaker::constraint::colocation { 'neutron-ovs-cleanup-to-netns-cleanup-colocation':
-        source  => 'neutron-netns-cleanup-clone',
-        target  => "${::neutron::params::ovs_cleanup_service}-clone",
-        score   => 'INFINITY',
-        require => [Pacemaker::Resource::Ocf[$::neutron::params::ovs_cleanup_service],
-                    Pacemaker::Resource::Ocf['neutron-netns-cleanup']],
-      }
-      pacemaker::constraint::base { 'neutron-netns-cleanup-to-openvswitch-agent-constraint':
-        constraint_type => 'order',
-        first_resource  => 'neutron-netns-cleanup-clone',
-        second_resource => "${::neutron::params::ovs_agent_service}-clone",
-        first_action    => 'start',
-        second_action   => 'start',
-        require         => [Pacemaker::Resource::Ocf['neutron-netns-cleanup'],
-                            Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service]],
-      }
-      pacemaker::constraint::colocation { 'neutron-netns-cleanup-to-openvswitch-agent-colocation':
-        source  => "${::neutron::params::ovs_agent_service}-clone",
-        target  => 'neutron-netns-cleanup-clone',
-        score   => 'INFINITY',
-        require => [Pacemaker::Resource::Ocf['neutron-netns-cleanup'],
-                    Pacemaker::Resource::Service[$::neutron::params::ovs_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':
@@ -832,20 +571,6 @@ password=\"${mysql_root_password}\"",
     }
 
     # Nova
-    pacemaker::resource::service { $::nova::params::api_service_name :
-      clone_params => 'interleave=true',
-    }
-    pacemaker::resource::service { $::nova::params::consoleauth_service_name :
-      clone_params => 'interleave=true',
-      require      => Pacemaker::Resource::Ocf['openstack-core'],
-    }
-    pacemaker::resource::service { $::nova::params::vncproxy_service_name :
-      clone_params => 'interleave=true',
-    }
-    pacemaker::resource::service { $::nova::params::scheduler_service_name :
-      clone_params => 'interleave=true',
-    }
-
     pacemaker::constraint::base { 'keystone-then-nova-consoleauth-constraint':
       constraint_type => 'order',
       first_resource  => 'openstack-core-clone',
@@ -855,6 +580,13 @@ password=\"${mysql_root_password}\"",
       require         => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
                           Pacemaker::Resource::Ocf['openstack-core']],
     }
+    pacemaker::constraint::colocation { 'nova-consoleauth-with-openstack-core':
+      source  => "${::nova::params::consoleauth_service_name}-clone",
+      target  => 'openstack-core-clone',
+      score   => 'INFINITY',
+      require => [Pacemaker::Resource::Service[$::nova::params::consoleauth_service_name],
+                  Pacemaker::Resource::Ocf['openstack-core']],
+    }
     pacemaker::constraint::base { 'nova-consoleauth-then-nova-vncproxy-constraint':
       constraint_type => 'order',
       first_resource  => "${::nova::params::consoleauth_service_name}-clone",