tripleo-heat-templates/puppet/services/metrics/collectd.yaml
Emilien Macchi b3a7cfc43f ansible: replace yum module by package module when possible
Problem: RHEL and CentOS8 will deprecate the usage of Yum.

From DNF release note:
DNF is the next upcoming major version of yum, a package
manager for RPM-based Linux distributions.
It roughly maintains CLI compatibility with YUM and defines a strict API for
extensions.

Solution: Use "package" Ansible module instead of "yum".

"package" module is smarter when it comes to detect with package manager
runs on the system. The goal of this patch is to support both yum/dnf
(dnf will be the default in rhel/centos 8) from a single ansible module.

Change-Id: I8e67d6f053e8790fdd0eb52a42035dca3051999e
2018-07-21 00:17:25 +00:00

332 lines
13 KiB
YAML

heat_template_version: rocky
description: Collectd client service
parameters:
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
DefaultPasswords:
default: {}
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
GnocchiPassword:
type: string
description: The password for the gnocchi service and db account.
hidden: true
KeystoneRegion:
type: string
description: Keystone region for endpoint
default: 'regionOne'
CollectdDefaultPollingInterval:
default: 120
type: number
description: >
Controls how often registered read functions are called and with that
the resolution of the collected data. This value can be overridden per
plugin(per role) by setting "::collectd::plugin::<plugin_name>::interval"
key in ExtraConfig(<role_name>ExtraConfig).
CollectdDefaultPlugins:
default:
- disk
- interface
- load
- memory
- processes
- tcpconns
- unixsock
type: comma_delimited_list
description: >
List of collectd plugins to activate on all overcloud hosts. See
the documentation for the puppet-collectd module for a list plugins
supported by the module (https://github.com/voxpupuli/puppet-collectd).
Set this key to override the default list of plugins. Use
CollectdExtraPlugins if you want to load additional plugins without
overriding the defaults.
CollectdExtraPlugins:
default: []
type: comma_delimited_list
description: >
List of collectd plugins to activate on all overcloud hosts. See
the documentation for the puppet-collectd module for a list plugins
supported by the module (https://github.com/voxpupuli/puppet-collectd).
Set this key to load plugins in addition to those in
CollectdDefaultPlugins.
CollectdServer:
type: string
description: >
Address of remote collectd server to which we will send
metrics.
default: ''
CollectdServerPort:
type: number
default: 25826
description: >
Port on remote collectd server to which we will send
metrics.
CollectdUsername:
type: string
description: >
Username for authenticating to the remote collectd server. The default
is to not configure any authentication.
default: ''
CollectdPassword:
type: string
hidden: true
description: >
Password for authenticating to the remote collectd server. The
default is to not configure any authentication.
default: ''
CollectdSecurityLevel:
type: string
description: >
Security level setting for remote collectd connection. If it is
set to Sign or Encrypt the CollectdPassword and CollectdUsername
parameters need to be set.
default: 'None'
constraints:
- allowed_values:
- None
- Sign
- Encrypt
CollectdGnocchiAuthMode:
type: string
description: >
Type of authentication Gnocchi server is using. Supported values are
'basic' and 'keystone'.
default: 'keystone'
CollectdGnocchiProtocol:
type: string
description: API protocol Gnocchi server is using.
default: 'http'
CollectdGnocchiServer:
type: string
description: >
The name or address of a gnocchi endpoint to which we should
send metrics.
default: nil
CollectdGnocchiPort:
type: number
description: The port to which we will connect on the Gnocchi server.
default: 8041
CollectdGnocchiUser:
type: string
description: >
Username for authenticating to the remote Gnocchi server using simple
authentication.
default: nil
CollectdGnocchiKeystoneAuthUrl:
type: string
description: Keystone endpoint URL to authenticate to.
default: nil
CollectdGnocchiKeystoneUserName:
type: string
description: Username for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneUserId:
type: string
description: User ID for authenticating to Keystone.
default: nil
CollectdGnocchiKeystonePassword:
type: string
description: Password for authenticating to Keystone
default: nil
hidden: true
CollectdGnocchiKeystoneProjectId:
type: string
description: Project ID for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneProjectName:
type: string
description: Project name for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneUserDomainId:
type: string
description: User domain ID for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneUserDomainName:
type: string
description: User domain name for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneProjectDomainId:
type: string
description: Project domain ID for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneProjectDomainName:
type: string
description: Project domain name for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneRegionName:
type: string
description: Region name for authenticating to Keystone.
default: nil
CollectdGnocchiKeystoneInterface:
type: string
description: Type of Keystone endpoint to authenticate to.
default: nil
CollectdGnocchiKeystoneEndpoint:
type: string
description: >
Explicitly state Gnocchi server URL if you want to override
Keystone value
default: nil
CollectdGnocchiResourceType:
type: string
description: >
Default resource type created by the collectd-gnocchi plugin in Gnocchi
to store hosts.
default: 'collectd'
CollectdGnocchiBatchSize:
type: number
description: Minimum number of values Gnocchi should batch.
default: 10
conditions:
gnocchi_default_connection:
and:
- equals: [{get_param: CollectdGnocchiServer}, nil]
- equals: [{get_param: CollectdGnocchiKeystoneEndpoint}, nil]
collectd_connection:
not:
equals: [{get_param: CollectdServer}, '']
gnocchi_auth_basic:
equals: [{get_param: CollectdGnocchiAuthMode}, 'basic']
outputs:
role_data:
description: Role data for the Collectd client role.
value:
service_name: collectd
config_settings:
map_merge:
- collectd::manage_repo: false
collectd::purge: true
collectd::recurse: true
collectd::purge_config: true
collectd::minimum_version: "5.7"
collectd::plugin::unixsock::socketgroup: root
collectd::plugin::unixsock::socketfile: /var/run/collectd-socket
collectd::interval: {get_param: CollectdDefaultPollingInterval}
tripleo.collectd.plugins.collectd:
yaql:
data:
default_plugins: {get_param: CollectdDefaultPlugins}
extra_plugins: {get_param: CollectdExtraPlugins}
expression: >
($.data.default_plugins + $.data.extra_plugins)
.flatten().distinct()
- if:
- collectd_connection # use server side collectd or gnocchi as metrics relay?
- tripleo::profile::base::metrics::collectd::collectd_server:
get_param: CollectdServer
tripleo::profile::base::metrics::collectd::collectd_port:
get_param: CollectdServerPort
tripleo::profile::base::metrics::collectd::collectd_username:
get_param: CollectdUsername
tripleo::profile::base::metrics::collectd::collectd_password:
get_param: CollectdPassword
tripleo::profile::base::metrics::collectd::collectd_securitylevel:
get_param: CollectdSecurityLevel
- map_merge:
- tripleo::profile::base::metrics::collectd::gnocchi_auth_mode:
get_param: CollectdGnocchiAuthMode
tripleo::profile::base::metrics::collectd::gnocchi_resource_type:
get_param: CollectdGnocchiResourceType
tripleo::profile::base::metrics::collectd::gnocchi_batch_size:
get_param: CollectdGnocchiBatchSize
- if:
- gnocchi_default_connection # use overcloud gnocchi instance or user provided instance?
- tripleo::profile::base::metrics::collectd::gnocchi_keystone_endpoint:
get_param: [EndpointMap, GnocchiInternal, uri]
tripleo::profile::base::metrics::collectd::gnocchi_keystone_auth_url:
get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]
tripleo::profile::base::metrics::collectd::gnocchi_keystone_user_name: 'gnocchi'
tripleo::profile::base::metrics::collectd::gnocchi_keystone_password:
get_param: GnocchiPassword
tripleo::profile::base::metrics::collectd::gnocchi_keystone_project_name: 'service'
tripleo::profile::base::metrics::collectd::gnocchi_keystone_user_domain_name: 'Default'
tripleo::profile::base::metrics::collectd::gnocchi_keystone_project_domain_name: 'Default'
tripleo::profile::base::metrics::collectd::gnocchi_keystone_region_name:
get_param: KeystoneRegion
- if:
- gnocchi_auth_basic # use basic auth or keystone auth?
- tripleo::profile::base::metrics::collectd::gnocchi_protocol:
get_param: CollectdGnocchiProtocol
tripleo::profile::base::metrics::collectd::gnocchi_server:
get_param: CollectdGnocchiServer
tripleo::profile::base::metrics::collectd::gnocchi_port:
get_param: CollectdGnocchiPort
tripleo::profile::base::metrics::collectd::gnocchi_user:
get_param: CollectdGnocchiUser
- tripleo::profile::base::metrics::collectd::gnocchi_keystone_auth_url:
get_param: CollectdGnocchiKeystoneAuthUrl
tripleo::profile::base::metrics::collectd::gnocchi_keystone_user_name:
get_param: CollectdGnocchiKeystoneUserName
tripleo::profile::base::metrics::collectd::gnocchi_keystone_user_id:
get_param: CollectdGnocchiKeystoneUserId
tripleo::profile::base::metrics::collectd::gnocchi_keystone_password:
get_param: CollectdGnocchiKeystonePassword
tripleo::profile::base::metrics::collectd::gnocchi_keystone_project_id:
get_param: CollectdGnocchiKeystoneProjectId
tripleo::profile::base::metrics::collectd::gnocchi_keystone_project_name:
get_param: CollectdGnocchiKeystoneProjectName
tripleo::profile::base::metrics::collectd::gnocchi_keystone_user_domain_id:
get_param: CollectdGnocchiKeystoneUserDomainId
tripleo::profile::base::metrics::collectd::gnocchi_keystone_user_domain_name:
get_param: CollectdGnocchiKeystoneUserDomainName
tripleo::profile::base::metrics::collectd::gnocchi_keystone_project_domain_id:
get_param: CollectdGnocchiKeystoneProjectDomainId
tripleo::profile::base::metrics::collectd::gnocchi_keystone_project_domain_name:
get_param: CollectdGnocchiKeystoneProjectDomainName
tripleo::profile::base::metrics::collectd::gnocchi_keystone_region_name:
get_param: CollectdGnocchiKeystoneRegionName
tripleo::profile::base::metrics::collectd::gnocchi_keystone_interface:
get_param: CollectdGnocchiKeystoneInterface
tripleo::profile::base::metrics::collectd::gnocchi_keystone_endpoint:
get_param: CollectdGnocchiKeystoneEndpoint
step_config: |
include ::tripleo::profile::base::metrics::collectd
upgrade_tasks:
- name: Check if collectd is deployed
command: systemctl is-enabled collectd
tags: common
ignore_errors: True
register: collectd_enabled
- name: Check status of collectd service
shell: >
/usr/bin/systemctl show collectd --property ActiveState |
grep '\bactive\b'
when:
- step|int == 0
- collectd_enabled.rc == 0
tags: validation
- name: Stop collectd service
when:
- step|int == 1
- collectd_enabled.rc == 0
service: name=collectd state=stopped
- name: Install collectd package if it was disabled
package: name=collectd state=latest
when:
- step|int == 3
- collectd_enabled.rc != 0