From 0defa3b3ea37c7ba1113ea953a72f1e847877059 Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Mon, 13 Mar 2017 13:26:43 +0800 Subject: [PATCH] Add panko.conf file in ceilometer container When using panko event dispatcher and publisher in ceilometer, it depends on panko.conf file. Change-Id: Ie91c072b233597758955b70bd526b2603b86e995 Closes-Bug: #1672241 --- ansible/roles/ceilometer/handlers/main.yml | 4 ++++ ansible/roles/ceilometer/tasks/config.yml | 23 +++++++++++++++++++ .../templates/ceilometer-collector.json.j2 | 7 ++++++ .../templates/ceilometer-notification.json.j2 | 7 ++++++ ansible/site.yml | 2 ++ 5 files changed, 43 insertions(+) diff --git a/ansible/roles/ceilometer/handlers/main.yml b/ansible/roles/ceilometer/handlers/main.yml index 3be79f2e87..a5bcf9788f 100644 --- a/ansible/roles/ceilometer/handlers/main.yml +++ b/ansible/roles/ceilometer/handlers/main.yml @@ -31,6 +31,7 @@ ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" policy_json: "{{ ceilometer_policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_notification_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" + panko_conf: "{{ panko_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" kolla_docker: action: "recreate_or_restart_container" common_options: "{{ docker_common_options }}" @@ -46,6 +47,7 @@ or policy_json.changed | bool or ceilometer_events.changed | bool or ceilometer_notification_container.changed | bool + or panko_conf.changed | bool - name: Restart ceilometer-central container vars: @@ -78,6 +80,7 @@ ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" policy_json: "{{ ceilometer_policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_collector_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" + panko_conf: "{{ panko_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" kolla_docker: action: "recreate_or_restart_container" common_options: "{{ docker_common_options }}" @@ -92,6 +95,7 @@ or ceilometer_conf.changed | bool or policy_json.changed | bool or ceilometer_collector_container.changed | bool + or panko_conf.changed | bool - name: Restart ceilometer-compute container vars: diff --git a/ansible/roles/ceilometer/tasks/config.yml b/ansible/roles/ceilometer/tasks/config.yml index 72e3763a23..d6276c3592 100644 --- a/ansible/roles/ceilometer/tasks/config.yml +++ b/ansible/roles/ceilometer/tasks/config.yml @@ -84,6 +84,29 @@ notify: - Restart ceilometer-notification container +- name: Copying over panko.conf + vars: + service_require_panko_conf: + - ceilometer-notification + - ceilometer-collector + merge_configs: + sources: + - ../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 }}/panko/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" register: ceilometer_policy diff --git a/ansible/roles/ceilometer/templates/ceilometer-collector.json.j2 b/ansible/roles/ceilometer/templates/ceilometer-collector.json.j2 index 99da6248a5..8af1a6108c 100644 --- a/ansible/roles/ceilometer/templates/ceilometer-collector.json.j2 +++ b/ansible/roles/ceilometer/templates/ceilometer-collector.json.j2 @@ -13,6 +13,13 @@ "owner": "ceilometer", "perm": "0600", "optional": true + }, + { + "source": "{{ container_config_directory }}/panko.conf", + "dest": "/etc/panko/panko.conf", + "owner": "ceilometer", + "perm": "0600", + "optional": true } ] } diff --git a/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 b/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 index 354ecf7a95..cc06c67dd5 100644 --- a/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 +++ b/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 @@ -31,6 +31,13 @@ "owner": "ceilometer", "perm": "0600", "optional": true + }, + { + "source": "{{ container_config_directory }}/panko.conf", + "dest": "/etc/panko/panko.conf", + "owner": "ceilometer", + "perm": "0600", + "optional": true } ] } diff --git a/ansible/site.yml b/ansible/site.yml index ecddd05ea5..05bf3bf2ff 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -428,6 +428,8 @@ - name: Apply role ceilometer gather_facts: false + vars_files: + - "roles/panko/defaults/main.yml" hosts: - ceilometer - compute