cluster: ceph
use_epel: false
devel_mode: true
+collector_dependencies:
+ yum:
+ # For the json python module
+ - python-libs
+ # For the rados python module
+ - python-rados
+ # For the ceph_daemon python module
+ - ceph-common
+ # For semodule
+ - make
+ - libsemanage-python
+ - policycoreutils-python
+ - selinux-policy-devel
+ apt:
+ # For the json module, via libpython2.7-stdlib
+ - python2.7
+ # For the rados python module
+ - python-rados
+ # For the ceph_daemon python module
+ - ceph-common
---
+- name: Set collectd_conf
+ set_fact:
+ collectd_conf: "/etc/{{ 'collectd/' if ansible_pkg_mgr == 'apt' else '' }}collectd.conf"
+
+- name: Set collectd_conf_d
+ set_fact:
+ collectd_conf_d: "/etc/collectd{{ '/collectd.conf' if ansible_pkg_mgr == 'apt' else '' }}.d"
+
- name: Ship collectd.conf
copy:
src: files/etc/collectd.conf
- dest: /etc/
+ dest: "{{ collectd_conf }}"
+ notify: Restart collectd
+
+- name: Set PluginDir in collectd.conf
+ replace:
+ dest: "{{ collectd_conf }}"
+ regexp: 'PluginDir ".*"'
+ replace: 'PluginDir "{{ collectd_dir }}"'
notify: Restart collectd
-- name: Ship /etc/collectd.d
+- name: Set Include path in collectd.conf
+ replace:
+ dest: "{{ collectd_conf }}"
+ regexp: 'Include ".*"'
+ replace: 'Include "{{ collectd_conf_d }}/*.conf"'
+ notify: Restart collectd
+
+- name: Ship /etc/collectd.d or /etc/collectd/collectd.conf.d
copy:
- src: files/etc/collectd.d
- dest: /etc/
+ src: files/etc/collectd.d/
+ dest: "{{ collectd_conf_d }}"
notify: Restart collectd
- name: Set hostname in write_graphite.conf
replace:
- dest: "/etc/collectd.d/write_graphite.conf"
+ dest: "{{ collectd_conf_d }}/write_graphite.conf"
regexp: 'Host ".*"'
replace: "Host \"{{ groups['ceph-grafana'][0] }}\""
notify: Restart collectd
- name: Set cluster name in cephmetrics.conf
replace:
- dest: /etc/collectd.d/cephmetrics.conf
+ dest: "{{ collectd_conf_d }}/cephmetrics.conf"
regexp: 'ClusterName ".*"'
replace: 'ClusterName "{{ cluster }}"'
notify: Restart collectd
+
+- name: Set ModulePath in cephmetrics.conf
+ replace:
+ dest: "{{ collectd_conf_d }}/cephmetrics.conf"
+ regexp: 'ModulePath ".*"'
+ replace: 'ModulePath "{{ collectd_cephmetrics_dir }}"'
+ notify: Restart collectd
---
- name: Set collectd_dir
set_fact:
- collectd_dir: /usr/lib64/collectd/cephmetrics
+ collectd_dir: "/usr/lib{{ '64' if ansible_pkg_mgr == 'yum' else '' }}/collectd"
+
+- name: Set collectd_cephmetrics_dir
+ set_fact:
+ collectd_cephmetrics_dir: "{{ collectd_dir }}/cephmetrics"
- name: Create collectors directory
file:
- name: "{{ collectd_dir }}/collectors"
+ name: "{{ collectd_cephmetrics_dir }}/collectors"
state: directory
- name: Ship collector plugins
copy:
src: files/collectors/
- dest: "{{ collectd_dir }}/collectors"
+ dest: "{{ collectd_cephmetrics_dir }}/collectors"
notify: Restart collectd
- name: Ship cephmetrics.py
copy:
src: files/cephmetrics.py
- dest: "{{ collectd_dir }}"
+ dest: "{{ collectd_cephmetrics_dir }}"
notify: Restart collectd
package:
name: "{{ item }}"
state: latest
- with_items:
- # For the json python module
- - python-libs
- # For the rados python module
- - python-rados
- # For the ceph_daemon python module
- - ceph-common
- # For semodule
- - make
- - libsemanage-python
- - policycoreutils-python
- - selinux-policy-devel
+ with_items: "{{ collector_dependencies[ansible_pkg_mgr] }}"
when:
- - ansible_pkg_mgr == "yum"
- devel_mode
notify: Restart collectd
- include: selinux.yml
when:
- not containerized_deployment
+ - ansible_pkg_mgr == "yum"
- ansible_selinux.status is defined
- ansible_selinux.status == 'enabled'
tags:
- ansible_pkg_mgr == "yum"
- devel_mode
+- name: Add collectd repo
+ template:
+ src: collectd.list
+ dest: /etc/apt/sources.list.d/collectd.list
+ when:
+ - ansible_pkg_mgr == 'apt'
+ - devel_mode
+
+- name: Add collectd.org GPG key to apt
+ apt_key:
+ id: 3994D24FB8543576
+ state: present
+ keyserver: ha.pool.sks-keyservers.net
+ when:
+ - ansible_pkg_mgr == 'apt'
+ - devel_mode
+
+- name: Update apt cache
+ apt:
+ update_cache: true
+ when:
+ - ansible_pkg_mgr == 'apt'
+ - devel_mode
+
- name: Install cephmetrics development repo
copy:
src: cephmetrics-devel.repo
--- /dev/null
+deb http://pkg.ci.collectd.org/deb {{ ansible_distribution_release }} collectd-5.7