kolla-ansible/ansible/roles/ceilometer/tasks/config.yml
guochao 7b385f9857 Add vmware support to ceilometer
Change-Id: I701a26ade57916c9e2ca6899228d4660230b1e0b
Partially-implements: blueprint kolla-ansible-support-vsphere
Depends-On:I0f37e49e09c4f14a64797506007bb55a6f534f0f
2017-08-16 09:07:13 +08:00

159 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-notification container
- Restart ceilometer-central container
- Restart ceilometer-compute container
- name: Copying over ceilometer.conf
vars:
service_name: "{{ item.key }}"
merge_configs:
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-notification container
- Restart ceilometer-central container
- Restart ceilometer-compute container
- name: Copying over event 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"
notify:
- Restart ceilometer-notification container
- name: Copying over pipeline.yaml file
vars:
services_require_pipeline:
- ceilometer-compute
- ceilometer-central
- ceilometer-notification
template:
src: "pipeline.yaml.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/pipeline.yaml"
register: ceilometer_pipelines
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
- item.key in services_require_pipeline
with_dict: "{{ ceilometer_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Copying over panko.conf
vars:
service_require_panko_conf:
- ceilometer-notification
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:
- enable_panko | bool
- 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: Copying VMware vCenter CA file
vars:
service: "{{ ceilometer_services['ceilometer-compute'] }}"
copy:
src: "{{ node_custom_config }}/vmware_ca"
dest: "{{ node_config_directory }}/ceilometer-compute/vmware_ca"
register: vcenter_ca_file
when:
- nova_compute_virt_type == "vmware"
- not vmware_vcenter_insecure | bool
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart ceilometer-compute 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-notification container
- Restart ceilometer-central 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-notification container
- Restart ceilometer-central container
- Restart ceilometer-compute container