Merge "Ansible roles for collectd Container"

This commit is contained in:
Jenkins 2016-09-12 11:47:00 +00:00 committed by Gerrit Code Review
commit 8249f3a188
16 changed files with 153 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View 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 }}"

View File

@ -0,0 +1,3 @@
---
dependencies:
- { role: common }

View 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"

View File

@ -0,0 +1,4 @@
---
- include: config.yml
- include: start.yml

View 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 }}"

View File

@ -0,0 +1,2 @@
---
- include: "{{ action }}.yml"

View File

@ -0,0 +1,6 @@
---
- name: Pulling CollectD image
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ collectd_image_full }}"

View File

@ -0,0 +1,3 @@
---
- include: do_reconfigure.yml
when: inventory_hostname in groups ['collectd']

View 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"

View File

@ -0,0 +1,4 @@
---
- include: config.yml
- include: start.yml

View File

@ -0,0 +1,3 @@
{
"command": "/usr/sbin/collectd -f"
}

View File

@ -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,

View File

@ -0,0 +1,3 @@
---
features:
- Add collectd ansible role