diff --git a/ansible/roles/ceilometer/handlers/main.yml b/ansible/roles/ceilometer/handlers/main.yml index 767468e703..344debf5cb 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 }}" 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 }}" panko_conf: "{{ panko_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" kolla_docker: @@ -35,6 +36,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 }}" 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 }}" kolla_docker: action: "recreate_or_restart_container" @@ -60,6 +62,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 }}" 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 }}" kolla_docker: action: "recreate_or_restart_container" diff --git a/ansible/roles/ceilometer/tasks/config.yml b/ansible/roles/ceilometer/tasks/config.yml index 767cb6b255..335d83aea3 100644 --- a/ansible/roles/ceilometer/tasks/config.yml +++ b/ansible/roles/ceilometer/tasks/config.yml @@ -12,6 +12,32 @@ - 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: "0600" + 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 if policies shall be overwritten local_action: stat path="{{ item }}" run_once: True diff --git a/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 b/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 index 277eae3baf..6cf4810abb 100644 --- a/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 +++ b/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 @@ -6,7 +6,13 @@ "dest": "/etc/ceilometer/ceilometer.conf", "owner": "ceilometer", "perm": "0600" - }{% if ceilometer_policy_file is defined %}, + }{% if ceilometer_polling_file_path is defined %}, + { + "source": "{{ container_config_directory }}/polling.yaml", + "dest": "/etc/ceilometer/polling.yaml", + "owner": "ceilometer", + "perm": "0600" + }{% endif %}{% if ceilometer_policy_file is defined %}, { "source": "{{ container_config_directory }}/{{ ceilometer_policy_file }}", "dest": "/etc/ceilometer/{{ ceilometer_policy_file }}", diff --git a/ansible/roles/ceilometer/templates/ceilometer-compute.json.j2 b/ansible/roles/ceilometer/templates/ceilometer-compute.json.j2 index 9a27ae7a9d..19e8e04725 100644 --- a/ansible/roles/ceilometer/templates/ceilometer-compute.json.j2 +++ b/ansible/roles/ceilometer/templates/ceilometer-compute.json.j2 @@ -6,7 +6,13 @@ "dest": "/etc/ceilometer/ceilometer.conf", "owner": "ceilometer", "perm": "0600" - }{% if ceilometer_policy_file is defined %}, + }{% if ceilometer_polling_file_path is defined %}, + { + "source": "{{ container_config_directory }}/polling.yaml", + "dest": "/etc/ceilometer/polling.yaml", + "owner": "ceilometer", + "perm": "0600" + }{% endif %}{% if ceilometer_policy_file is defined %}, { "source": "{{ container_config_directory }}/{{ ceilometer_policy_file }}", "dest": "/etc/ceilometer/{{ ceilometer_policy_file }}", diff --git a/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 b/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 index bad19d9777..cf6eeee05f 100644 --- a/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 +++ b/ansible/roles/ceilometer/templates/ceilometer-notification.json.j2 @@ -24,7 +24,13 @@ "dest": "/etc/ceilometer/pipeline.yaml", "owner": "ceilometer", "perm": "0600" - }{% if ceilometer_policy_file is defined %}, + }{% if ceilometer_polling_file_path is defined %}, + { + "source": "{{ container_config_directory }}/polling.yaml", + "dest": "/etc/ceilometer/polling.yaml", + "owner": "ceilometer", + "perm": "0600" + }{% endif %}{% if ceilometer_policy_file is defined %}, { "source": "{{ container_config_directory }}/{{ ceilometer_policy_file }}", "dest": "/etc/ceilometer/{{ ceilometer_policy_file }}",