kolla-ansible/ansible/roles/ceilometer/tasks/config.yml
Ning Yao 4b1a1d57a9 Add support for Ceilometer custom gnocchi_resources.yaml
By default, Ceilometer uses gnocchi_resources.yaml as cfg_file that defines
the metric archive policy and metrics send to gnocchi. Users may want to define
their own strategy.

Change-Id: I49ba34588101ac2b4f450067c8c9a354134063bb
Signed-off-by: Ning Yao <yaoning@unitedstack.com>
2019-04-25 15:30:54 +08:00

243 lines
7.8 KiB
YAML

---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
mode: "0770"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
- name: Check custom polling.yaml exists
local_action: stat path="{{ node_custom_config }}/ceilometer/polling.yaml"
register: ceilometer_polling_file
- name: Copying over polling.yaml
copy:
src: "{{ node_custom_config }}/ceilometer/polling.yaml"
dest: "{{ node_config_directory }}/{{ item.key }}/polling.yaml"
force: True
mode: "0660"
become: true
register: ceilometer_polling_overwriting
when:
- ceilometer_polling_file.stat.exists
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Set ceilometer polling file's path
set_fact:
ceilometer_polling_file_path: "{{ ceilometer_polling_file.stat.path }}"
when:
- ceilometer_polling_file.stat.exists
- name: Check custom gnocchi_resources.yaml exists
local_action: stat path="{{ node_custom_config }}/ceilometer/gnocchi_resources.yaml"
register: ceilometer_gnocchi_resources_file
- name: Copying over gnocchi_resources.yaml
copy:
src: "{{ node_custom_config }}/ceilometer/gnocchi_resources.yaml"
dest: "{{ node_config_directory }}/{{ item.key }}/gnocchi_resources.yaml"
force: True
mode: "0660"
become: true
register: ceilometer_gnocchi_resources_overwriting
when:
- ceilometer_gnocchi_resources_file.stat.exists
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Set ceilometer gnocchi_resources file's path
set_fact:
ceilometer_gnocchi_resources_file_path: "{{ ceilometer_gnocchi_resources_file.stat.path }}"
when:
- ceilometer_gnocchi_resources_file.stat.exists
- name: Check if policies shall be overwritten
local_action: stat path="{{ item }}"
run_once: True
register: ceilometer_policy
with_first_found:
- files: "{{ supported_policy_format_list }}"
paths:
- "{{ node_custom_config }}/ceilometer/"
skip: true
- name: Set ceilometer policy file
set_fact:
ceilometer_policy_file: "{{ ceilometer_policy.results.0.stat.path | basename }}"
ceilometer_policy_file_path: "{{ ceilometer_policy.results.0.stat.path }}"
when:
- ceilometer_policy.results
- name: Copying over config.json files for services
template:
src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
mode: "0660"
become: true
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
- Restart ceilometer-ipmi 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 }}/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"
mode: "0660"
become: true
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
- Restart ceilometer-ipmi 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 }}"
mode: "0660"
become: true
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"
mode: "0660"
become: true
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"
mode: "0660"
become: true
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"
mode: "0660"
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: Copying over existing policy file
template:
src: "{{ ceilometer_policy_file_path }}"
dest: "{{ node_config_directory }}/{{ item.key }}/{{ ceilometer_policy_file }}"
mode: "0660"
become: true
register: ceilometer_policy_overwriting
when:
- ceilometer_policy_file is defined
- 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
- Restart ceilometer-ipmi container
# check whether the containers parameter is changed. If yes, trigger the handler.
- name: Check ceilometer containers
become: true
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 | reject('equalto', '')|list }}"
dimensions: "{{ item.value.dimensions }}"
register: check_ceilometer_containers
when:
- kolla_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
- Restart ceilometer-ipmi container