diff --git a/ansible/roles/ceilometer/defaults/main.yml b/ansible/roles/ceilometer/defaults/main.yml index 0fbc2e2388..1fe005d1fc 100644 --- a/ansible/roles/ceilometer/defaults/main.yml +++ b/ansible/roles/ceilometer/defaults/main.yml @@ -100,12 +100,9 @@ ceilometer_ipmi_extra_volumes: "{{ ceilometer_extra_volumes }}" # OpenStack #################### ceilometer_logging_debug: "{{ openstack_logging_debug }}" - ceilometer_keystone_user: "ceilometer" - openstack_ceilometer_auth: "{{ openstack_auth }}" - #################### # Kolla #################### @@ -115,6 +112,7 @@ ceilometer_dev_mode: "{{ kolla_dev_mode }}" ceilometer_source_version: "{{ kolla_source_version }}" ceilometer_custom_meters_local_folder: "meters.d" +ceilometer_dynamic_pollsters_local_folder: "pollsters.d" #################### # Keystone diff --git a/ansible/roles/ceilometer/tasks/config.yml b/ansible/roles/ceilometer/tasks/config.yml index 90395f8ba3..ca37980ed0 100644 --- a/ansible/roles/ceilometer/tasks/config.yml +++ b/ansible/roles/ceilometer/tasks/config.yml @@ -63,6 +63,46 @@ notify: - "Restart {{ item.key }} container" +- name: Check if the folder ["{{ node_custom_config }}/ceilometer/{{ ceilometer_dynamic_pollsters_local_folder }}"] for dynamic pollsters definitions exist + stat: + path: "{{ node_custom_config }}/ceilometer/{{ ceilometer_dynamic_pollsters_local_folder }}" + delegate_to: localhost + register: ceilometer_dynamic_pollsters_folder + run_once: True + +- name: Set the variable that control the copy of dynamic pollsters definitions + set_fact: + should_copy_dynamic_pollster_definitions: "{{ ceilometer_dynamic_pollsters_folder.stat.exists and ceilometer_dynamic_pollsters_folder.stat.isdir }}" + +- name: Clean default folder for dynamic pollsters definitions + file: + state: absent + path: "{{ node_config_directory }}/ceilometer-central/pollsters.d/" + +- name: Create default folder for dynamic pollsters definitions + file: + path: "{{ node_config_directory }}/ceilometer-central/pollsters.d" + state: "directory" + owner: "{{ config_owner_user }}" + group: "{{ config_owner_group }}" + mode: "0770" + become: true + when: + - should_copy_dynamic_pollster_definitions + - inventory_hostname in groups['ceilometer-central'] + +- name: Copying dynamic pollsters definitions + copy: + src: "{{ node_custom_config }}/ceilometer/{{ ceilometer_dynamic_pollsters_local_folder }}/" + dest: "{{ node_config_directory }}/ceilometer-central/pollsters.d/" + mode: "0660" + become: true + when: + - should_copy_dynamic_pollster_definitions + - inventory_hostname in groups['ceilometer-central'] + notify: + - "Restart ceilometer-central container" + - name: Check if custom polling.yaml exists stat: path: "{{ node_custom_config }}/ceilometer/polling.yaml" diff --git a/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 b/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 index d97096f99f..5912248190 100644 --- a/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 +++ b/ansible/roles/ceilometer/templates/ceilometer-central.json.j2 @@ -30,6 +30,12 @@ "dest": "/etc/ceilometer/meters.d", "owner": "ceilometer", "perm": "0700" + }{% endif %}{% if should_copy_dynamic_pollster_definitions %}, + { + "source": "{{ container_config_directory }}/{{ ceilometer_dynamic_pollsters_local_folder }}", + "dest": "/etc/ceilometer/pollsters.d", + "owner": "ceilometer", + "perm": "0700" }{% endif %}, { "source": "{{ container_config_directory }}/pipeline.yaml", diff --git a/releasenotes/notes/manage_dynamic_pollster_configs-14bd3b6775e6a07a.yaml b/releasenotes/notes/manage_dynamic_pollster_configs-14bd3b6775e6a07a.yaml new file mode 100644 index 0000000000..cec8fe8b8f --- /dev/null +++ b/releasenotes/notes/manage_dynamic_pollster_configs-14bd3b6775e6a07a.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Add support for managing Ceilometer dynamic pollster configuration in + Kolla-ansible. This feature will look for configurations in + ``{{ node_custom_config }}/ceilometer/pollster.d/`` by default. + If there are configs there, they are copied to the control nodes, + to configure Ceilometer dynamic pollster sub-system.