aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorprithiv <prithiv.mohan@intel.com>2016-09-09 10:20:18 +0100
committerprithiv <prithiv.mohan@intel.com>2016-09-09 10:20:18 +0100
commit4af9bbe2e3ce289a99e90e6a5c3252359fb9a2ab (patch)
tree3e1c061f56f0d191803f9b970897165cf3798ea5 /ansible
parentabf4193aa754b191710d96737be244a590b14fdb (diff)
downloadkolla-4af9bbe2e3ce289a99e90e6a5c3252359fb9a2ab.tar.gz
kolla-4af9bbe2e3ce289a99e90e6a5c3252359fb9a2ab.zip
Ansible roles for collectd Container
Collectd-ceilometer-plugin is essential for further more detailed metrics collection, smarter scheduling and service assurance. Change-Id: I8da572980de370517ec120d745ad1d36e316b465 Implements: blueprint collectd-ceilometer-plugin
Diffstat (limited to 'ansible')
-rw-r--r--ansible/group_vars/all.yml2
-rw-r--r--ansible/inventory/all-in-one3
-rw-r--r--ansible/inventory/multinode3
-rw-r--r--ansible/roles/collectd/defaults/main.yml12
-rw-r--r--ansible/roles/collectd/meta/main.yml3
-rw-r--r--ansible/roles/collectd/tasks/config.yml23
-rw-r--r--ansible/roles/collectd/tasks/deploy.yml4
-rw-r--r--ansible/roles/collectd/tasks/do_reconfigure.yml61
-rw-r--r--ansible/roles/collectd/tasks/main.yml2
-rw-r--r--ansible/roles/collectd/tasks/pull.yml6
-rw-r--r--ansible/roles/collectd/tasks/reconfigure.yml3
-rw-r--r--ansible/roles/collectd/tasks/start.yml15
-rw-r--r--ansible/roles/collectd/tasks/upgrade.yml4
-rw-r--r--ansible/roles/collectd/templates/collectd.json.j23
-rw-r--r--ansible/site.yml6
15 files changed, 150 insertions, 0 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index f99073716..05bea988a 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -268,6 +268,8 @@ nova_keystone_user: "nova"
enable_nova_fake: "no"
num_nova_fake_per_node: 5
+# Monitoring options are specified here
+enable_collectd: "no"
####################
# Logging options
diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one
index 779c22773..e9ee7913f 100644
--- a/ansible/inventory/all-in-one
+++ b/ansible/inventory/all-in-one
@@ -17,6 +17,9 @@ localhost ansible_connection=local
# You can explicitly specify which hosts run each project by updating the
# groups in the sections below. Common services are grouped together.
+[collectd:children]
+compute
+
[kibana:children]
control
diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode
index 2c8a7bb21..3f91b86ff 100644
--- a/ansible/inventory/multinode
+++ b/ansible/inventory/multinode
@@ -35,6 +35,9 @@ storage
# You can explicitly specify which hosts run each project by updating the
# groups in the sections below. Common services are grouped together.
+[collectd:children]
+compute
+
[influxdb:children]
monitoring
diff --git a/ansible/roles/collectd/defaults/main.yml b/ansible/roles/collectd/defaults/main.yml
new file mode 100644
index 000000000..93cfd4cf3
--- /dev/null
+++ b/ansible/roles/collectd/defaults/main.yml
@@ -0,0 +1,12 @@
+---
+####################
+# Docker
+####################
+collectd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-collectd"
+collectd_tag: "{{ openstack_release }}"
+collectd_image_full: "{{ collectd_image }}:{{ collectd_tag }}"
+
+####################
+# OpenStack
+####################
+collectd_logging_debug: "{{ openstack_logging_debug }}"
diff --git a/ansible/roles/collectd/meta/main.yml b/ansible/roles/collectd/meta/main.yml
new file mode 100644
index 000000000..6b4fff8fe
--- /dev/null
+++ b/ansible/roles/collectd/meta/main.yml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - { role: common }
diff --git a/ansible/roles/collectd/tasks/config.yml b/ansible/roles/collectd/tasks/config.yml
new file mode 100644
index 000000000..a9eaf08a5
--- /dev/null
+++ b/ansible/roles/collectd/tasks/config.yml
@@ -0,0 +1,23 @@
+---
+- name: Ensuring CollectD config directories exist
+ file:
+ path: "{{ node_config_directory }}/{{ item }}"
+ state: "directory"
+ recurse: yes
+ with_items:
+ - "collectd"
+
+- name: Ensuring Plugin directory exist
+ file:
+ path: "{{ node_config_directory }}/{{ item }}/collectd.conf.d"
+ state: "directory"
+ recurse: yes
+ with_items:
+ - "collectd"
+
+- name: Copying over config.json files for services
+ template:
+ src: "{{ item }}.json.j2"
+ dest: "{{ node_config_directory }}/{{ item }}/config.json"
+ with_items:
+ - "collectd"
diff --git a/ansible/roles/collectd/tasks/deploy.yml b/ansible/roles/collectd/tasks/deploy.yml
new file mode 100644
index 000000000..1f16915ad
--- /dev/null
+++ b/ansible/roles/collectd/tasks/deploy.yml
@@ -0,0 +1,4 @@
+---
+- include: config.yml
+
+- include: start.yml
diff --git a/ansible/roles/collectd/tasks/do_reconfigure.yml b/ansible/roles/collectd/tasks/do_reconfigure.yml
new file mode 100644
index 000000000..602850983
--- /dev/null
+++ b/ansible/roles/collectd/tasks/do_reconfigure.yml
@@ -0,0 +1,61 @@
+---
+- name: Ensuring the containers up
+ kolla_docker:
+ name: "{{ item.name }}"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: collectd, group: collectd }
+
+- include: config.yml
+
+- name: Check the configs
+ command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ register: check_results
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: collectd, group: collectd }
+
+- name: Containers config strategy
+ kolla_docker:
+ name: "{{ item.name }}"
+ action: "get_container_env"
+ register: container_envs
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: collectd, group: collectd }
+
+- name: Remove the containers
+ kolla_docker:
+ name: "{{ item[0]['name'] }}"
+ action: "remove_container"
+ register: remove_containers
+ when:
+ - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
+ - item[2]['rc'] == 1
+ - inventory_hostname in groups[item[0]['group']]
+ with_together:
+ - [{ name: collectd, group: collectd }]
+ - "{{ container_envs.results }}"
+ - "{{ check_results.results }}"
+
+- include: start.yml
+ when: remove_containers.changed
+
+- name: Restart containers
+ kolla_docker:
+ name: "{{ item[0]['name'] }}"
+ action: "restart_container"
+ when:
+ - config_strategy == 'COPY_ALWAYS'
+ - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[2]['rc'] == 1
+ - inventory_hostname in groups[item[0]['group']]
+ with_together:
+ - [{ name: collectd, group: collectd }]
+ - "{{ container_envs.results }}"
+ - "{{ check_results.results }}"
diff --git a/ansible/roles/collectd/tasks/main.yml b/ansible/roles/collectd/tasks/main.yml
new file mode 100644
index 000000000..b017e8b4a
--- /dev/null
+++ b/ansible/roles/collectd/tasks/main.yml
@@ -0,0 +1,2 @@
+---
+- include: "{{ action }}.yml"
diff --git a/ansible/roles/collectd/tasks/pull.yml b/ansible/roles/collectd/tasks/pull.yml
new file mode 100644
index 000000000..300163f16
--- /dev/null
+++ b/ansible/roles/collectd/tasks/pull.yml
@@ -0,0 +1,6 @@
+---
+- name: Pulling CollectD image
+ kolla_docker:
+ action: "pull_image"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ collectd_image_full }}"
diff --git a/ansible/roles/collectd/tasks/reconfigure.yml b/ansible/roles/collectd/tasks/reconfigure.yml
new file mode 100644
index 000000000..859dc5cc0
--- /dev/null
+++ b/ansible/roles/collectd/tasks/reconfigure.yml
@@ -0,0 +1,3 @@
+---
+- include: do_reconfigure.yml
+ when: inventory_hostname in groups ['collectd']
diff --git a/ansible/roles/collectd/tasks/start.yml b/ansible/roles/collectd/tasks/start.yml
new file mode 100644
index 000000000..fbce11dad
--- /dev/null
+++ b/ansible/roles/collectd/tasks/start.yml
@@ -0,0 +1,15 @@
+---
+- name: Starting CollectD container
+ kolla_docker:
+ action: "start_container"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ collectd_image_full }}"
+ name: "collectd"
+ privileged: True
+ volumes:
+ - "{{ node_config_directory }}/collectd/:{{ container_config_directory }}/:ro"
+ - "{{node_config_directory }}/collectd/collectd.conf.d/:/etc/collectd/collectd.conf.d/"
+ - "/etc/localtime:/etc/localtime:ro"
+ - "kolla_logs:/var/log/kolla/"
+ - "/sys/:/sys/:ro"
+ - "/dev/:/dev/:ro"
diff --git a/ansible/roles/collectd/tasks/upgrade.yml b/ansible/roles/collectd/tasks/upgrade.yml
new file mode 100644
index 000000000..1f16915ad
--- /dev/null
+++ b/ansible/roles/collectd/tasks/upgrade.yml
@@ -0,0 +1,4 @@
+---
+- include: config.yml
+
+- include: start.yml
diff --git a/ansible/roles/collectd/templates/collectd.json.j2 b/ansible/roles/collectd/templates/collectd.json.j2
new file mode 100644
index 000000000..7d7017927
--- /dev/null
+++ b/ansible/roles/collectd/templates/collectd.json.j2
@@ -0,0 +1,3 @@
+{
+ "command": "/usr/sbin/collectd -f"
+}
diff --git a/ansible/site.yml b/ansible/site.yml
index cc6311ba1..da9d09cc5 100644
--- a/ansible/site.yml
+++ b/ansible/site.yml
@@ -8,6 +8,12 @@
tags: ceph,
when: enable_ceph | bool }
+- hosts: collectd
+ roles:
+ - { role: collectd,
+ tags: collectd,
+ when: enable_collectd | bool }
+
- hosts: elasticsearch
roles:
- { role: elasticsearch,