Deploy RabbitMQ as a composable role
authorEmilien Macchi <emilien@redhat.com>
Mon, 2 May 2016 21:35:00 +0000 (17:35 -0400)
committerEmilien Macchi <emilien@redhat.com>
Wed, 18 May 2016 19:43:31 +0000 (21:43 +0200)
Change the way to implement RabbitMQ, as a composable role.

Implements: blueprint refactor-puppet-manifests
Change-Id: I5fed5c437ad492af75791a9163f99ae292f58895

environments/puppet-pacemaker.yaml
overcloud-resource-registry-puppet.yaml
overcloud.yaml
puppet/controller.yaml
puppet/manifests/overcloud_controller.pp
puppet/manifests/overcloud_controller_pacemaker.pp
puppet/services/pacemaker/rabbitmq.yaml [new file with mode: 0644]
puppet/services/rabbitmq.yaml [new file with mode: 0644]

index 631b7b8..61ad24b 100644 (file)
@@ -15,3 +15,4 @@ resource_registry:
   OS::TripleO::Services::NeutronDhcpAgent: ../puppet/services/pacemaker/neutron-dhcp.yaml
   OS::TripleO::Services::NeutronL3Agent: ../puppet/services/pacemaker/neutron-l3.yaml
   OS::TripleO::Services::NeutronMetadataAgent: ../puppet/services/pacemaker/neutron-metadata.yaml
+  OS::TripleO::Services::RabbitMQ: ../puppet/services/pacemaker/rabbitmq.yaml
index 433cc72..e358f17 100644 (file)
@@ -129,6 +129,7 @@ resource_registry:
   OS::TripleO::Services::NeutronDhcpAgent: puppet/services/neutron-dhcp.yaml
   OS::TripleO::Services::NeutronL3Agent: puppet/services/neutron-l3.yaml
   OS::TripleO::Services::NeutronMetadataAgent: puppet/services/neutron-metadata.yaml
+  OS::TripleO::Services::RabbitMQ: puppet/services/rabbitmq.yaml
 
 parameter_defaults:
   EnablePackageInstall: false
index fb1e53d..0a9d80e 100644 (file)
@@ -298,15 +298,6 @@ parameters:
     default: 5672
     description: Set rabbit subscriber port, change this if using SSL
     type: number
-  # We need to set this as string because 'unlimited' is a valid setting
-  RabbitFDLimit:
-    default: 16384
-    description: Configures RabbitMQ FD limit
-    type: string
-  RabbitIPv6:
-    default: false
-    description: Enable IPv6 in RabbitMQ
-    type: boolean
   RedisPassword:
     description: The password for Redis
     type: string
@@ -666,6 +657,7 @@ parameters:
       - OS::TripleO::Services::NeutronDhcpAgent
       - OS::TripleO::Services::NeutronL3Agent
       - OS::TripleO::Services::NeutronMetadataAgent
+      - OS::TripleO::Services::RabbitMQ
     description: A list of service resources (configured in the Heat
                  resource_registry) which represent nested stacks
                  for each service that should get installed on the Controllers.
@@ -958,8 +950,6 @@ resources:
           RabbitCookie: {get_attr: [RabbitCookie, value]}
           RabbitClientUseSSL: {get_param: RabbitClientUseSSL}
           RabbitClientPort: {get_param: RabbitClientPort}
-          RabbitFDLimit: {get_param: RabbitFDLimit}
-          RabbitIPv6: {get_param: RabbitIPv6}
           RedisPassword: {get_param: RedisPassword}
           SaharaPassword: {get_param: SaharaPassword}
           SnmpdReadonlyUserName: {get_param: SnmpdReadonlyUserName}
index 9f183b9..05556ff 100644 (file)
@@ -534,14 +534,6 @@ parameters:
     default: 5672
     description: Set rabbit subscriber port, change this if using SSL
     type: number
-  RabbitFDLimit:
-    default: 16384
-    description: Configures RabbitMQ FD limit
-    type: string
-  RabbitIPv6:
-    default: false
-    description: Enable IPv6 in RabbitMQ
-    type: boolean
   RedisPassword:
     type: string
     description: The password to access the Redis service
@@ -1108,8 +1100,6 @@ resources:
         rabbit_cookie: {get_param: RabbitCookie}
         rabbit_client_use_ssl: {get_param: RabbitClientUseSSL}
         rabbit_client_port: {get_param: RabbitClientPort}
-        rabbit_ipv6: {get_param: RabbitIPv6}
-        rabbit_fd_limit: {get_param: RabbitFDLimit}
         mongodb_no_journal: {get_param: MongoDbNoJournal}
         mongodb_ipv6: {get_param: MongoDbIPv6}
         ntp_servers: {get_param: NtpServer}
@@ -1557,14 +1547,9 @@ resources:
                 sahara::keystone::auth::admin_url: {get_input: sahara_admin_url }
                 sahara::keystone::auth::password: {get_input: sahara_password }
                 sahara::keystone::auth::region: {get_input: keystone_region}
-
-                # Rabbit
+                # RabbitMQ
                 rabbitmq::node_ip_address: {get_input: rabbitmq_network}
                 rabbitmq::erlang_cookie: {get_input: rabbit_cookie}
-                rabbitmq::file_limit: {get_input: rabbit_fd_limit}
-                rabbitmq::default_user: {get_input: rabbit_username}
-                rabbitmq::default_pass: {get_input: rabbit_password}
-                rabbit_ipv6: {get_input: rabbit_ipv6}
                 # Redis
                 redis::bind: {get_input: redis_network}
                 redis::requirepass: {get_input: redis_password}
index 7ea9214..6c2716a 100644 (file)
@@ -127,36 +127,6 @@ if hiera('step') >= 2 {
     include ::aodh::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
-  }
-
   # pre-install swift here so we can build rings
   include ::swift
 
index 4e0d1c3..5c6e15a 100644 (file)
@@ -114,35 +114,6 @@ if hiera('step') >= 1 {
     op_params => 'start timeout=200s stop timeout=200s',
   }
 
-  # Only configure RabbitMQ in this step, don't start it yet to
-  # 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   => $rabbit_env,
-  } ->
-  file { '/var/lib/rabbitmq/.erlang.cookie':
-    ensure  => file,
-    owner   => 'rabbitmq',
-    group   => 'rabbitmq',
-    mode    => '0400',
-    content => hiera('rabbitmq::erlang_cookie'),
-    replace => true,
-  }
-
   if downcase(hiera('ceilometer_backend')) == 'mongodb' {
     include ::mongodb::globals
     include ::mongodb::client
@@ -304,14 +275,6 @@ if hiera('step') >= 2 {
       require      => Class['::memcached'],
     }
 
-    pacemaker::resource::ocf { 'rabbitmq':
-      ocf_agent_name  => 'heartbeat:rabbitmq-cluster',
-      resource_params => 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\'',
-      clone_params    => 'ordered=true interleave=true',
-      meta_params     => 'notify=true',
-      require         => Class['::rabbitmq'],
-    }
-
     if downcase(hiera('ceilometer_backend')) == 'mongodb' {
       pacemaker::resource::service { $::mongodb::params::service_name :
         op_params    => 'start timeout=370s stop timeout=200s',
diff --git a/puppet/services/pacemaker/rabbitmq.yaml b/puppet/services/pacemaker/rabbitmq.yaml
new file mode 100644 (file)
index 0000000..613db44
--- /dev/null
@@ -0,0 +1,32 @@
+heat_template_version: 2016-04-08
+
+description: >
+  RabbitMQ service with Pacemaker configured with Puppet
+
+parameters:
+  EndpointMap:
+    default: {}
+    description: Mapping of service endpoint -> protocol. Typically set
+                 via parameter_defaults in the resource registry.
+    type: json
+  MysqlVirtualIPUri:
+    type: string
+    default: ''
+
+resources:
+  RabbitMQServiceBase:
+    type: ../rabbitmq.yaml
+    properties:
+      EndpointMap: {get_param: EndpointMap}
+      MysqlVirtualIPUri: {get_param: MysqlVirtualIPUri}
+
+outputs:
+  role_data:
+    description: Role data for the RabbitMQ pacemaker role.
+    value:
+      config_settings:
+        map_merge:
+          - get_attr: [RabbitMQServiceBase, role_data, config_settings]
+          - rabbitmq::service_manage: false
+      step_config: |
+        include ::tripleo::profile::pacemaker::rabbitmq
diff --git a/puppet/services/rabbitmq.yaml b/puppet/services/rabbitmq.yaml
new file mode 100644 (file)
index 0000000..ae5678a
--- /dev/null
@@ -0,0 +1,42 @@
+heat_template_version: 2016-04-08
+
+description: >
+  RabbitMQ service configured with Puppet
+
+parameters:
+  EndpointMap:
+    default: {}
+    description: Mapping of service endpoint -> protocol. Typically set
+                 via parameter_defaults in the resource registry.
+    type: json
+  MysqlVirtualIPUri:
+    type: string
+    default: ''
+  RabbitUserName:
+    default: guest
+    description: The username for RabbitMQ
+    type: string
+  RabbitPassword:
+    description: The password for RabbitMQ
+    type: string
+    hidden: true
+  RabbitFDLimit:
+    default: 16384
+    description: Configures RabbitMQ FD limit
+    type: string
+  RabbitIPv6:
+    default: false
+    description: Enable IPv6 in RabbitMQ
+    type: boolean
+
+outputs:
+  role_data:
+    description: Role data for the RabbitMQ role.
+    value:
+      config_settings:
+        rabbitmq::file_limit: {get_param: RabbitFDLimit}
+        rabbitmq::default_user: {get_param: RabbitUserName}
+        rabbitmq::default_pass: {get_param: RabbitPassword}
+        rabbit_ipv6: {get_param: RabbitIPv6}
+      step_config: |
+        include ::tripleo::profile::base::rabbitmq