Merge "Method to override the default ceilometer meters.yaml via Kolla-ansible"

This commit is contained in:
Zuul 2019-06-24 13:08:28 +00:00 committed by Gerrit Code Review
commit 7cfab57cb9
5 changed files with 67 additions and 1 deletions

View File

@ -109,3 +109,5 @@ ceilometer_git_repository: "{{ kolla_dev_repos_git }}/ceilometer"
ceilometer_dev_repos_pull: "{{ kolla_dev_repos_pull }}" ceilometer_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
ceilometer_dev_mode: "{{ kolla_dev_mode }}" ceilometer_dev_mode: "{{ kolla_dev_mode }}"
ceilometer_source_version: "{{ kolla_source_version }}" ceilometer_source_version: "{{ kolla_source_version }}"
ceilometer_custom_meters_local_folder: "meters.d"

View File

@ -12,7 +12,53 @@
- item.value.enabled | bool - item.value.enabled | bool
with_dict: "{{ ceilometer_services }}" with_dict: "{{ ceilometer_services }}"
- name: Check custom polling.yaml exists - name: Check if the folder for custom meter definitions exist
local_action: stat path="{{ node_custom_config }}/ceilometer/{{ ceilometer_custom_meters_local_folder }}"
register: ceilometer_custom_meters_folder
- name: Set variable that indicates if we have a folder for custom meter YAML files
set_fact:
custom_meter_folder_exist: "{{ ceilometer_custom_meters_folder.stat.exists and ceilometer_custom_meters_folder.stat.isdir }}"
- name: Find all *.yaml files in custom meter definitions folder (if the folder exist)
local_action: find paths="{{ node_custom_config }}/ceilometer/{{ ceilometer_custom_meters_local_folder }}" patterns="*.yaml"
register: ceilometer_custom_meters_folder_found_files
when: custom_meter_folder_exist
- name: Set the variable that control the copy of custom meter definitions
set_fact:
should_copy_custom_meter_definitions: "{{ custom_meter_folder_exist and ceilometer_custom_meters_folder_found_files.matched > 0 }}"
- name: Create default folder for custom meter definitions
file:
path: "{{ node_config_directory }}/{{ item.key }}/meters.d"
state: "directory"
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
mode: "0770"
become: true
with_dict: "{{ ceilometer_services }}"
when:
- should_copy_custom_meter_definitions
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
- name: Copying custom meter definitions to Ceilometer
copy:
src: "{{ node_custom_config }}/ceilometer/{{ ceilometer_custom_meters_local_folder }}/"
dest: "{{ node_config_directory }}/{{ item.key }}/meters.d"
force: True
mode: "0660"
become: true
when:
- should_copy_custom_meter_definitions
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Check if custom polling.yaml exists
local_action: stat path="{{ node_custom_config }}/ceilometer/polling.yaml" local_action: stat path="{{ node_custom_config }}/ceilometer/polling.yaml"
register: ceilometer_polling_file register: ceilometer_polling_file

View File

@ -24,6 +24,12 @@
"dest": "/etc/ceilometer/{{ ceilometer_policy_file }}", "dest": "/etc/ceilometer/{{ ceilometer_policy_file }}",
"owner": "ceilometer", "owner": "ceilometer",
"perm": "0600" "perm": "0600"
}{% endif %}{% if should_copy_custom_meter_definitions %},
{
"source": "{{ container_config_directory }}/meters.d",
"dest": "/etc/ceilometer/meters.d",
"owner": "ceilometer",
"perm": "0700"
}{% endif %}, }{% endif %},
{ {
"source": "{{ container_config_directory }}/pipeline.yaml", "source": "{{ container_config_directory }}/pipeline.yaml",

View File

@ -24,6 +24,12 @@
"dest": "/etc/ceilometer/{{ ceilometer_policy_file }}", "dest": "/etc/ceilometer/{{ ceilometer_policy_file }}",
"owner": "ceilometer", "owner": "ceilometer",
"perm": "0600" "perm": "0600"
}{% endif %}{% if should_copy_custom_meter_definitions %},
{
"source": "{{ container_config_directory }}/meters.d",
"dest": "/etc/ceilometer/meters.d",
"owner": "ceilometer",
"perm": "0700"
}{% endif %}, }{% endif %},
{ {
"source": "{{ container_config_directory }}/pipeline.yaml", "source": "{{ container_config_directory }}/pipeline.yaml",

View File

@ -24,6 +24,12 @@
"dest": "/etc/ceilometer/{{ ceilometer_policy_file }}", "dest": "/etc/ceilometer/{{ ceilometer_policy_file }}",
"owner": "ceilometer", "owner": "ceilometer",
"perm": "0600" "perm": "0600"
}{% endif %}{% if should_copy_custom_meter_definitions %},
{
"source": "{{ container_config_directory }}/meters.d",
"dest": "/etc/ceilometer/meters.d",
"owner": "ceilometer",
"perm": "0700"
}{% endif %} }{% endif %}
], ],
"permissions": [ "permissions": [