kolla-ansible/ansible/roles/ceilometer/tasks/config.yml
Bertrand Lallau a9113fc466 Avoid launching "local" actions too many times
In order to speed up deployment time some "local" actions should be run
only once using 'run_once: True'.
This will decrease deployment time in case of multihost configuration.

Change-Id: I6015d772d35c15e96c52f577013b6e41197cb41a
2017-07-05 15:55:39 +02:00

153 lines
5.3 KiB
YAML

---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
recurse: yes
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
- name: Copying over config.json files for services
template:
src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
register: ceilometer_config_jsons
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
notify:
- Restart ceilometer-api container
- Restart ceilometer-notification container
- Restart ceilometer-central container
- Restart ceilometer-collector container
- Restart ceilometer-compute container
- name: Copying over wsgi-ceilometer-api.conf
vars:
service: "{{ ceilometer_services['ceilometer-api'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/ceilometer-api/wsgi-ceilometer-api.conf"
with_first_found:
- "{{ node_custom_config }}/ceilometer/{{ inventory_hostname }}/wsgi-ceilometer-api.conf"
- "{{ node_custom_config }}/ceilometer/wsgi-ceilometer-api.conf"
- "wsgi-ceilometer-api.conf.j2"
register: wsgi_ceilometer_api
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart ceilometer-api container
- name: Copying over ceilometer.conf
merge_configs:
vars:
service_name: "{{ item.key }}"
sources:
- "{{ role_path }}/templates/ceilometer.conf.j2"
- "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/database.conf"
- "{{ node_custom_config }}/messaging.conf"
- "{{ node_custom_config }}/ceilometer.conf"
- "{{ node_custom_config }}/ceilometer/{{ item.key }}.conf"
- "{{ node_custom_config }}/ceilometer/{{ inventory_hostname }}/ceilometer.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/ceilometer.conf"
register: ceilometer_confs
when:
- item.value.enabled | bool
- inventory_hostname in groups[item.value.group]
with_dict: "{{ ceilometer_services }}"
notify:
- Restart ceilometer-api container
- Restart ceilometer-notification container
- Restart ceilometer-central container
- Restart ceilometer-collector container
- Restart ceilometer-compute container
- name: Copying over event and pipeline yaml for notification service
vars:
service: "{{ ceilometer_services['ceilometer-notification'] }}"
template:
src: "{{ item }}.j2"
dest: "{{ node_config_directory }}/ceilometer-notification/{{ item }}"
register: ceilometer_events
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_items:
- "event_definitions.yaml"
- "event_pipeline.yaml"
- "pipeline.yaml"
notify:
- Restart ceilometer-notification container
- name: Copying over panko.conf
vars:
service_require_panko_conf:
- ceilometer-notification
- ceilometer-collector
merge_configs:
sources:
- "{{ role_path }}/../panko/templates/panko.conf.j2"
- "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/panko.conf"
- "{{ node_custom_config }}/panko/panko.conf"
- "{{ node_custom_config }}/panko/{{ inventory_hostname }}/panko.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/panko.conf"
register: panko_confs
when:
- ceilometer_event_type == 'panko'
- item.value.enabled | bool
- inventory_hostname in groups[item.value.group]
- item.key in service_require_panko_conf
with_dict: "{{ ceilometer_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/ceilometer/policy.json"
run_once: True
register: ceilometer_policy
- name: Copying over existing policy.json
template:
src: "{{ node_custom_config }}/ceilometer/policy.json"
dest: "{{ node_config_directory }}/{{ item.key }}/policy.json"
register: ceilometer_policy_jsons
when:
- ceilometer_policy.stat.exists
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
notify:
- Restart ceilometer-api container
- Restart ceilometer-notification container
- Restart ceilometer-central container
- Restart ceilometer-collector container
- Restart ceilometer-compute container
# check whether the containers parameter is changed. If yes, trigger the handler.
- name: Check ceilometer containers
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
privileged: "{{ item.value.privileged | default(False) }}"
volumes: "{{ item.value.volumes }}"
register: check_ceilometer_containers
when:
- action != "config"
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
notify:
- Restart ceilometer-api container
- Restart ceilometer-notification container
- Restart ceilometer-central container
- Restart ceilometer-collector container
- Restart ceilometer-compute container