From c89b901524a7494180de1614a7b5e255589ecbb8 Mon Sep 17 00:00:00 2001 From: ZijianGuo Date: Wed, 22 May 2019 17:23:18 +0800 Subject: [PATCH] Add support for ceilometer custom pipeline.yaml This file can be modified to adjust polling intervals or other configurations. We can add a custom 'pipeline.yaml' file to override it. Change-Id: I325523edc4f7e37db55a2e21fe52e76138e6d114 Signed-off-by: ZijianGuo --- ansible/roles/ceilometer/handlers/main.yml | 6 +++++ ansible/roles/ceilometer/tasks/config.yml | 27 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/ansible/roles/ceilometer/handlers/main.yml b/ansible/roles/ceilometer/handlers/main.yml index c32cc91daa..e422694196 100644 --- a/ansible/roles/ceilometer/handlers/main.yml +++ b/ansible/roles/ceilometer/handlers/main.yml @@ -7,6 +7,7 @@ ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_pipeline: "{{ ceilometer_pipelines.results|selectattr('item.key', 'equalto', service_name)|first }}" gnocchi_resources_overwriting: "{{ ceilometer_gnocchi_resources_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" + pipeline_overwriting: "{{ ceilometer_pipeline_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" policy_overwriting: "{{ ceilometer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" polling_overwriting: "{{ ceilometer_polling_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_notification_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" @@ -26,6 +27,7 @@ - config_json.changed | bool or ceilometer_conf.changed | bool or gnocchi_resources_overwriting.changed | bool + or pipeline_overwriting.changed | bool or policy_overwriting.changed | bool or polling_overwriting.changed | bool or ceilometer_events.changed | bool @@ -41,6 +43,7 @@ ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_pipeline: "{{ ceilometer_pipelines.results|selectattr('item.key', 'equalto', service_name)|first }}" gnocchi_resources_overwriting: "{{ ceilometer_gnocchi_resources_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" + pipeline_overwriting: "{{ ceilometer_pipeline_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" policy_overwriting: "{{ ceilometer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" polling_overwriting: "{{ ceilometer_polling_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_central_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" @@ -60,6 +63,7 @@ or ceilometer_conf.changed | bool or ceilometer_pipeline.changed | bool or gnocchi_resources_overwriting.changed | bool + or pipeline_overwriting.changed | bool or policy_overwriting.changed | bool or polling_overwriting.changed | bool or ceilometer_central_container.changed | bool @@ -72,6 +76,7 @@ ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_pipeline: "{{ ceilometer_pipelines.results|selectattr('item.key', 'equalto', service_name)|first }}" gnocchi_resources_overwriting: "{{ ceilometer_gnocchi_resources_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" + pipeline_overwriting: "{{ ceilometer_pipeline_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" policy_overwriting: "{{ ceilometer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" polling_overwriting: "{{ ceilometer_polling_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" ceilometer_compute_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" @@ -92,6 +97,7 @@ or ceilometer_conf.changed | bool or ceilometer_pipeline.changed | bool or gnocchi_resources_overwriting.changed | bool + or pipeline_overwriting.changed | bool or policy_overwriting.changed | bool or polling_overwriting.changed | bool or vcenter_ca_file.changed | bool diff --git a/ansible/roles/ceilometer/tasks/config.yml b/ansible/roles/ceilometer/tasks/config.yml index 0204ddb24b..0de42446b2 100644 --- a/ansible/roles/ceilometer/tasks/config.yml +++ b/ansible/roles/ceilometer/tasks/config.yml @@ -140,6 +140,32 @@ notify: - Restart ceilometer-notification container +- name: Check custom pipeline.yaml exists + local_action: stat path="{{ node_custom_config }}/ceilometer/pipeline.yaml" + register: ceilometer_pipeline_file + +- name: Copying over pipeline.yaml + vars: + services_require_pipeline: + - ceilometer-compute + - ceilometer-central + - ceilometer-notification + copy: + src: "{{ node_custom_config }}/ceilometer/pipeline.yaml" + dest: "{{ node_config_directory }}/{{ item.key }}/pipeline.yaml" + force: True + mode: "0660" + become: true + register: ceilometer_pipeline_overwriting + when: + - ceilometer_pipeline_file.stat.exists + - 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 pipeline.yaml file vars: services_require_pipeline: @@ -156,6 +182,7 @@ - inventory_hostname in groups[item.value.group] - item.value.enabled | bool - item.key in services_require_pipeline + - not ceilometer_pipeline_file.stat.exists with_dict: "{{ ceilometer_services }}" notify: - "Restart {{ item.key }} container"