Add ceilometer profiles
authorPradeep Kilambi <pkilambi@redhat.com>
Tue, 12 Apr 2016 14:49:43 +0000 (10:49 -0400)
committerEmilien Macchi <emilien@redhat.com>
Mon, 20 Jun 2016 18:41:58 +0000 (14:41 -0400)
Implements: blueprint refactor-puppet-manifests

Change-Id: I4b5e93a108e80e91af26ffee454130ee18c0042e

12 files changed:
manifests/profile/base/ceilometer.pp [new file with mode: 0644]
manifests/profile/base/ceilometer/agent/central.pp [new file with mode: 0644]
manifests/profile/base/ceilometer/agent/compute.pp [new file with mode: 0644]
manifests/profile/base/ceilometer/agent/notification.pp [new file with mode: 0644]
manifests/profile/base/ceilometer/api.pp [new file with mode: 0644]
manifests/profile/base/ceilometer/collector.pp [new file with mode: 0644]
manifests/profile/base/ceilometer/expirer.pp [new file with mode: 0644]
manifests/profile/pacemaker/ceilometer.pp [new file with mode: 0644]
manifests/profile/pacemaker/ceilometer/agent/central.pp [new file with mode: 0644]
manifests/profile/pacemaker/ceilometer/agent/notification.pp [new file with mode: 0644]
manifests/profile/pacemaker/ceilometer/api.pp [new file with mode: 0644]
manifests/profile/pacemaker/ceilometer/collector.pp [new file with mode: 0644]

diff --git a/manifests/profile/base/ceilometer.pp b/manifests/profile/base/ceilometer.pp
new file mode 100644 (file)
index 0000000..a7d62ce
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::ceilometer
+#
+# Ceilometer profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+# [*pacemaker_master*]
+#   (Optional) The master node runs some tasks
+#   one step earlier than others; disable to
+#   the node is not the master.
+#   Defaults to true
+
+class tripleo::profile::base::ceilometer (
+  $step             = hiera('step'),
+  $pacemaker_master = true,
+) {
+
+  if $step >= 4 or ($step >= 3 and $pacemaker_master) {
+    include ::ceilometer
+    include ::ceilometer::db
+    include ::ceilometer::config
+  }
+
+}
diff --git a/manifests/profile/base/ceilometer/agent/central.pp b/manifests/profile/base/ceilometer/agent/central.pp
new file mode 100644 (file)
index 0000000..02d6d1a
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::ceilometer::agent::central
+#
+# Ceilometer Central Agent profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+
+class tripleo::profile::base::ceilometer::agent::central (
+  $step = hiera('step'),
+) {
+
+  include ::tripleo::profile::base::ceilometer
+
+  if $step >= 4 {
+    include ::ceilometer::agent::auth
+    include ::ceilometer::agent::central
+  }
+
+}
diff --git a/manifests/profile/base/ceilometer/agent/compute.pp b/manifests/profile/base/ceilometer/agent/compute.pp
new file mode 100644 (file)
index 0000000..3a7aa50
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::ceilometer::agent::compute
+#
+# Ceilometer Compute Agent profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+
+class tripleo::profile::base::ceilometer::agent::compute (
+  $step = hiera('step'),
+) {
+
+  include ::tripleo::profile::base::ceilometer
+
+  if $step >= 4 {
+    include ::ceilometer::agent::auth
+    include ::ceilometer::agent::compute
+  }
+
+}
diff --git a/manifests/profile/base/ceilometer/agent/notification.pp b/manifests/profile/base/ceilometer/agent/notification.pp
new file mode 100644 (file)
index 0000000..83a0234
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::ceilometer::agent::notification
+#
+# Ceilometer Notification Agent profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+
+class tripleo::profile::base::ceilometer::agent::notification (
+  $step = hiera('step'),
+) {
+
+  include ::tripleo::profile::base::ceilometer
+
+  if $step >= 4 {
+    include ::ceilometer::agent::auth
+    include ::ceilometer::agent::notification
+  }
+
+}
diff --git a/manifests/profile/base/ceilometer/api.pp b/manifests/profile/base/ceilometer/api.pp
new file mode 100644 (file)
index 0000000..e324c00
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::ceilometer::api
+#
+# Ceilometer API profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+
+class tripleo::profile::base::ceilometer::api (
+  $step = hiera('step'),
+) {
+
+  include ::tripleo::profile::base::ceilometer
+
+  if $step >= 4 {
+    include ::ceilometer::api
+  }
+
+}
diff --git a/manifests/profile/base/ceilometer/collector.pp b/manifests/profile/base/ceilometer/collector.pp
new file mode 100644 (file)
index 0000000..6891f9c
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::ceilometer::collector
+#
+# Ceilometer Collector profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+# [*sync_db*]
+#   (Optional) Whether to run db sync
+#   Defaults to true
+#
+
+class tripleo::profile::base::ceilometer::collector (
+  $step    = hiera('step'),
+  $sync_db = true,
+) {
+
+  class { '::tripleo::profile::base::ceilometer':
+    pacemaker_master => $sync_db,
+  }
+
+  if $step >= 3 and $sync_db {
+    $ceilometer_backend = downcase(hiera('ceilometer_backend', 'mongodb'))
+    if $ceilometer_backend == 'mysql' {
+      include ::ceilometer::db::mysql
+    }
+  }
+
+  if $step >= 4 {
+    include ::ceilometer::collector
+    include ::ceilometer::dispatcher::gnocchi
+  }
+
+}
diff --git a/manifests/profile/base/ceilometer/expirer.pp b/manifests/profile/base/ceilometer/expirer.pp
new file mode 100644 (file)
index 0000000..43d8c26
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::ceilometer::expirer
+#
+# Ceilometer Expirer profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+
+class tripleo::profile::base::ceilometer::expirer (
+  $step = hiera('step'),
+) {
+
+  include ::tripleo::profile::base::ceilometer
+
+  if $step >= 4 {
+    include ::ceilometer::expirer
+    Cron <| title == 'ceilometer-expirer' |> { command => "sleep $((\$(od -A n -t d -N 3 /dev/urandom) % 86400)) && ${::ceilometer::params::expirer_command}" }
+  }
+
+}
diff --git a/manifests/profile/pacemaker/ceilometer.pp b/manifests/profile/pacemaker/ceilometer.pp
new file mode 100644 (file)
index 0000000..0c21807
--- /dev/null
@@ -0,0 +1,138 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::pacemaker::ceilometer
+#
+# Ceilometer Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*bootstrap_node*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+# [*sync_db*]
+#   (Optional) Whether to run db sync
+#   Defaults to undef
+#
+class tripleo::profile::pacemaker::ceilometer (
+  $bootstrap_node = hiera('bootstrap_nodeid'),
+  $step           = hiera('step'),
+  $sync_db        = true,
+) {
+
+  if $::hostname == downcase($bootstrap_node) {
+    $pacemaker_master = true
+  } else {
+    $pacemaker_master = false
+  }
+
+  include ::tripleo::profile::base::ceilometer
+
+  if $step >= 5 and $pacemaker_master {
+    $ceilometer_backend = downcase(hiera('ceilometer_backend', 'mongodb'))
+    case $ceilometer_backend {
+      /mysql/: {
+        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
+          clone_params => 'interleave=true',
+          require      => Pacemaker::Resource::Ocf['openstack-core'],
+        }
+      }
+      default: {
+        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
+          clone_params => 'interleave=true',
+          require      => [Pacemaker::Resource::Ocf['openstack-core'],
+            Pacemaker::Resource::Service[$::mongodb::params::service_name]],
+        }
+      }
+    }
+
+    if $sync_db {
+      if $ceilometer_backend == 'mysql' {
+        class { '::ceilometer::db::mysql':
+          require => Exec['galera-ready'],
+        }
+      }
+    }
+
+    # NOTE(emilien): the constraints won't live forever here as we're moving to
+    # pacemaker-lite architecture.
+
+    # Fedora doesn't know `require-all` parameter for constraints yet
+    if $::operatingsystem == 'Fedora' {
+      $redis_ceilometer_constraint_params = undef
+    } else {
+      $redis_ceilometer_constraint_params = 'require-all=false'
+    }
+    pacemaker::constraint::base { 'redis-then-ceilometer-central-constraint':
+      constraint_type   => 'order',
+      first_resource    => 'redis-master',
+      second_resource   => "${::ceilometer::params::agent_central_service_name}-clone",
+      first_action      => 'promote',
+      second_action     => 'start',
+      constraint_params => $redis_ceilometer_constraint_params,
+      require           => [Pacemaker::Resource::Ocf['redis'],
+                            Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name]],
+    }
+    pacemaker::constraint::base { 'keystone-then-ceilometer-central-constraint':
+      constraint_type => 'order',
+      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::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',
+      first_resource  => "${::ceilometer::params::agent_central_service_name}-clone",
+      second_resource => "${::ceilometer::params::collector_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::ceilometer::params::agent_central_service_name],
+                          Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name]],
+    }
+    pacemaker::constraint::base { 'ceilometer-collector-then-ceilometer-api-constraint':
+      constraint_type => 'order',
+      first_resource  => "${::ceilometer::params::collector_service_name}-clone",
+      second_resource => "${::ceilometer::params::api_service_name}-clone",
+      first_action    => 'start',
+      second_action   => 'start',
+      require         => [Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name],
+                          Pacemaker::Resource::Service[$::ceilometer::params::api_service_name]],
+    }
+    pacemaker::constraint::colocation { 'ceilometer-api-with-ceilometer-collector-colocation':
+      source  => "${::ceilometer::params::api_service_name}-clone",
+      target  => "${::ceilometer::params::collector_service_name}-clone",
+      score   => 'INFINITY',
+      require => [Pacemaker::Resource::Service[$::ceilometer::params::api_service_name],
+                  Pacemaker::Resource::Service[$::ceilometer::params::collector_service_name]],
+    }
+  }
+
+}
diff --git a/manifests/profile/pacemaker/ceilometer/agent/central.pp b/manifests/profile/pacemaker/ceilometer/agent/central.pp
new file mode 100644 (file)
index 0000000..e227614
--- /dev/null
@@ -0,0 +1,58 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::pacemaker::ceilometer::agent::central
+#
+# Ceilometer Central Agent Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*pacemaker_master*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+class tripleo::profile::pacemaker::ceilometer::agent::central (
+  $pacemaker_master = hiera('bootstrap_nodeid'),
+  $step             = hiera('step'),
+) {
+
+  include ::ceilometer::params
+  include ::tripleo::profile::pacemaker::ceilometer
+  include ::tripleo::profile::base::ceilometer::agent::central
+
+  if $step >= 5 and downcase($::hostname) == $pacemaker_master {
+    $ceilometer_backend = downcase(hiera('ceilometer_backend', 'mongodb'))
+    case downcase(hiera('ceilometer_backend')) {
+      /mysql/: {
+        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
+          clone_params => 'interleave=true',
+          require      => Pacemaker::Resource::Ocf['openstack-core'],
+        }
+      }
+      default: {
+        pacemaker::resource::service { $::ceilometer::params::agent_central_service_name:
+          clone_params => 'interleave=true',
+          require      => [Pacemaker::Resource::Ocf['openstack-core'],
+                          Pacemaker::Resource::Service[$::mongodb::params::service_name]],
+        }
+      }
+    }
+  }
+
+}
diff --git a/manifests/profile/pacemaker/ceilometer/agent/notification.pp b/manifests/profile/pacemaker/ceilometer/agent/notification.pp
new file mode 100644 (file)
index 0000000..868bb22
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::pacemaker::ceilometer::agent::notification
+#
+# Ceilometer Notification Agent Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*pacemaker_master*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+class tripleo::profile::pacemaker::ceilometer::agent::notification (
+  $pacemaker_master = hiera('bootstrap_nodeid'),
+  $step             = hiera('step'),
+) {
+
+  include ::ceilometer::params
+  include ::tripleo::profile::pacemaker::ceilometer
+  include ::tripleo::profile::base::ceilometer::agent::notification
+
+  if $step >= 5 and downcase($::hostname) == $pacemaker_master {
+    pacemaker::resource::service { $::ceilometer::params::agent_notification_service_name :
+      clone_params => 'interleave=true',
+    }
+  }
+
+}
diff --git a/manifests/profile/pacemaker/ceilometer/api.pp b/manifests/profile/pacemaker/ceilometer/api.pp
new file mode 100644 (file)
index 0000000..cfe103a
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::pacemaker::ceilometer::api
+#
+# Ceilometer API Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*pacemaker_master*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+class tripleo::profile::pacemaker::ceilometer::api (
+  $pacemaker_master = hiera('bootstrap_nodeid'),
+  $step             = hiera('step'),
+) {
+
+  include ::ceilometer::params
+  include ::tripleo::profile::pacemaker::ceilometer
+  include ::tripleo::profile::base::ceilometer::api
+
+  if $step >= 5 and downcase($::hostname) == $pacemaker_master {
+    pacemaker::resource::service { $::ceilometer::params::api_service_name :
+      clone_params => 'interleave=true',
+    }
+    pacemaker::constraint::colocation { 'ceilometer-delay-with-ceilometer-api-colocation':
+      source  => 'delay-clone',
+      target  => "${::ceilometer::params::api_service_name}-clone",
+      score   => 'INFINITY',
+      require => [Pacemaker::Resource::Service[$::ceilometer::params::api_service_name],
+        Pacemaker::Resource::Ocf['delay']],
+    }
+  }
+
+}
diff --git a/manifests/profile/pacemaker/ceilometer/collector.pp b/manifests/profile/pacemaker/ceilometer/collector.pp
new file mode 100644 (file)
index 0000000..2a838f2
--- /dev/null
@@ -0,0 +1,57 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::pacemaker::ceilometer::collector
+#
+# Ceilometer Collector Pacemaker HA profile for tripleo
+#
+# === Parameters
+#
+# [*pacemaker_master*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+# [*sync_db*]
+#   (Optional) Whether to run db sync
+#   Defaults to undef
+#
+class tripleo::profile::pacemaker::ceilometer::collector (
+  $pacemaker_master = hiera('bootstrap_nodeid'),
+  $step             = hiera('step'),
+  $sync_db          = true,
+) {
+
+  include ::ceilometer::params
+  include ::tripleo::profile::pacemaker::ceilometer
+
+  class { '::tripleo::profile::base::ceilometer::collector':
+    sync_db => (downcase($::hostname) == $pacemaker_master),
+  }
+
+  if $step >= 5 and downcase($::hostname) == $pacemaker_master {
+    $ceilometer_backend = downcase(hiera('ceilometer_backend', 'mongodb'))
+    if $ceilometer_backend == 'mysql' {
+      Exec<| title == 'galera-ready'|> -> Class['ceilometer::db::mysql']
+    }
+    pacemaker::resource::service { $::ceilometer::params::collector_service_name :
+      clone_params => 'interleave=true',
+    }
+  }
+
+}