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
This commit is contained in:
parent
abf4193aa7
commit
4af9bbe2e3
@ -268,6 +268,8 @@ nova_keystone_user: "nova"
|
|||||||
enable_nova_fake: "no"
|
enable_nova_fake: "no"
|
||||||
num_nova_fake_per_node: 5
|
num_nova_fake_per_node: 5
|
||||||
|
|
||||||
|
# Monitoring options are specified here
|
||||||
|
enable_collectd: "no"
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Logging options
|
# Logging options
|
||||||
|
@ -17,6 +17,9 @@ localhost ansible_connection=local
|
|||||||
|
|
||||||
# You can explicitly specify which hosts run each project by updating the
|
# You can explicitly specify which hosts run each project by updating the
|
||||||
# groups in the sections below. Common services are grouped together.
|
# groups in the sections below. Common services are grouped together.
|
||||||
|
[collectd:children]
|
||||||
|
compute
|
||||||
|
|
||||||
[kibana:children]
|
[kibana:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
@ -35,6 +35,9 @@ storage
|
|||||||
|
|
||||||
# You can explicitly specify which hosts run each project by updating the
|
# You can explicitly specify which hosts run each project by updating the
|
||||||
# groups in the sections below. Common services are grouped together.
|
# groups in the sections below. Common services are grouped together.
|
||||||
|
[collectd:children]
|
||||||
|
compute
|
||||||
|
|
||||||
[influxdb:children]
|
[influxdb:children]
|
||||||
monitoring
|
monitoring
|
||||||
|
|
||||||
|
12
ansible/roles/collectd/defaults/main.yml
Normal file
12
ansible/roles/collectd/defaults/main.yml
Normal file
@ -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 }}"
|
3
ansible/roles/collectd/meta/main.yml
Normal file
3
ansible/roles/collectd/meta/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- { role: common }
|
23
ansible/roles/collectd/tasks/config.yml
Normal file
23
ansible/roles/collectd/tasks/config.yml
Normal file
@ -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"
|
4
ansible/roles/collectd/tasks/deploy.yml
Normal file
4
ansible/roles/collectd/tasks/deploy.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- include: config.yml
|
||||||
|
|
||||||
|
- include: start.yml
|
61
ansible/roles/collectd/tasks/do_reconfigure.yml
Normal file
61
ansible/roles/collectd/tasks/do_reconfigure.yml
Normal file
@ -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 }}"
|
2
ansible/roles/collectd/tasks/main.yml
Normal file
2
ansible/roles/collectd/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- include: "{{ action }}.yml"
|
6
ansible/roles/collectd/tasks/pull.yml
Normal file
6
ansible/roles/collectd/tasks/pull.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Pulling CollectD image
|
||||||
|
kolla_docker:
|
||||||
|
action: "pull_image"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
image: "{{ collectd_image_full }}"
|
3
ansible/roles/collectd/tasks/reconfigure.yml
Normal file
3
ansible/roles/collectd/tasks/reconfigure.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- include: do_reconfigure.yml
|
||||||
|
when: inventory_hostname in groups ['collectd']
|
15
ansible/roles/collectd/tasks/start.yml
Normal file
15
ansible/roles/collectd/tasks/start.yml
Normal file
@ -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"
|
4
ansible/roles/collectd/tasks/upgrade.yml
Normal file
4
ansible/roles/collectd/tasks/upgrade.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- include: config.yml
|
||||||
|
|
||||||
|
- include: start.yml
|
3
ansible/roles/collectd/templates/collectd.json.j2
Normal file
3
ansible/roles/collectd/templates/collectd.json.j2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"command": "/usr/sbin/collectd -f"
|
||||||
|
}
|
@ -8,6 +8,12 @@
|
|||||||
tags: ceph,
|
tags: ceph,
|
||||||
when: enable_ceph | bool }
|
when: enable_ceph | bool }
|
||||||
|
|
||||||
|
- hosts: collectd
|
||||||
|
roles:
|
||||||
|
- { role: collectd,
|
||||||
|
tags: collectd,
|
||||||
|
when: enable_collectd | bool }
|
||||||
|
|
||||||
- hosts: elasticsearch
|
- hosts: elasticsearch
|
||||||
roles:
|
roles:
|
||||||
- { role: elasticsearch,
|
- { role: elasticsearch,
|
||||||
|
3
releasenotes/notes/add-collectd-6e3387dfff75040a.yaml
Normal file
3
releasenotes/notes/add-collectd-6e3387dfff75040a.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Add collectd ansible role
|
Loading…
Reference in New Issue
Block a user