kolla-ansible/ansible/roles/ceilometer/tasks/config.yml
caoyuan 7ec120aec3 Optimize reconfiguration for ceilometer
Change-Id: I9667e087f3dede751ce80734511e53761f5e9298
Partially-implements: blueprint better-reconfigure
2017-01-24 13:57:38 +00:00

129 lines
4.5 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: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/ceilometer/policy.json"
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