Merge "Enable kolla-ansible to use a custom metrics files with Cloudkitty"

This commit is contained in:
Zuul 2019-06-03 18:06:57 +00:00 committed by Gerrit Code Review
commit c3f011f128
5 changed files with 38 additions and 0 deletions

View File

@ -90,3 +90,4 @@ cloudkitty_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
cloudkitty_dev_repos_pull: "{{ kolla_dev_repos_pull }}" cloudkitty_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
cloudkitty_dev_mode: "{{ kolla_dev_mode }}" cloudkitty_dev_mode: "{{ kolla_dev_mode }}"
cloudkitty_source_version: "{{ kolla_source_version }}" cloudkitty_source_version: "{{ kolla_source_version }}"
cloudkitty_custom_metrics_yaml_file: "metrics.yml"

View File

@ -29,6 +29,28 @@
when: when:
- cloudkitty_policy.results - cloudkitty_policy.results
- name: Check if custom {{ cloudkitty_custom_metrics_yaml_file }} exists
local_action: stat path="{{ node_custom_config }}/cloudkitty/{{ cloudkitty_custom_metrics_yaml_file }}"
register: cloudkitty_custom_metrics_file
- name: Copying {{ cloudkitty_custom_metrics_yaml_file }} if it exists
copy:
src: "{{ node_custom_config }}/cloudkitty/{{ cloudkitty_custom_metrics_yaml_file }}"
dest: "{{ node_config_directory }}/{{ item.key }}/{{ cloudkitty_custom_metrics_yaml_file }}"
mode: "0660"
become: true
when:
- cloudkitty_custom_metrics_file.stat.exists
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ cloudkitty_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Are we using {{ cloudkitty_custom_metrics_yaml_file }}?
set_fact:
cloudkitty_custom_metrics_used: "{{ cloudkitty_custom_metrics_file.stat.exists }}"
- name: Copying over config.json files for services - name: Copying over config.json files for services
template: template:
src: "{{ item.key }}.json.j2" src: "{{ item.key }}.json.j2"

View File

@ -20,6 +20,12 @@
"dest": "/etc/cloudkitty/{{ cloudkitty_policy_file }}", "dest": "/etc/cloudkitty/{{ cloudkitty_policy_file }}",
"owner": "cloudkitty", "owner": "cloudkitty",
"perm": "0600" "perm": "0600"
}{% endif %}{% if cloudkitty_custom_metrics_used %},
{
"source": "{{ container_config_directory }}/{{ cloudkitty_custom_metrics_yaml_file }}",
"dest": "/etc/cloudkitty/{{ cloudkitty_custom_metrics_yaml_file }}",
"owner": "cloudkitty",
"perm": "0600"
}{% endif %} }{% endif %}
], ],
"permissions": [ "permissions": [

View File

@ -12,6 +12,12 @@
"dest": "/etc/cloudkitty/{{ cloudkitty_policy_file }}", "dest": "/etc/cloudkitty/{{ cloudkitty_policy_file }}",
"owner": "cloudkitty", "owner": "cloudkitty",
"perm": "0600" "perm": "0600"
}{% endif %}{% if cloudkitty_custom_metrics_used %},
{
"source": "{{ container_config_directory }}/{{ cloudkitty_custom_metrics_yaml_file }}",
"dest": "/etc/cloudkitty/{{ cloudkitty_custom_metrics_yaml_file }}",
"owner": "cloudkitty",
"perm": "0600"
}{% endif %} }{% endif %}
], ],
"permissions": [ "permissions": [

View File

@ -40,6 +40,9 @@ policy_file = {{ cloudkitty_policy_file }}
[collect] [collect]
collector = {{ cloudkitty_collector_backend }} collector = {{ cloudkitty_collector_backend }}
services = compute,image{% if enable_cinder | bool %},volume{% endif %},network.bw.out,network.bw.in,network.floating services = compute,image{% if enable_cinder | bool %},volume{% endif %},network.bw.out,network.bw.in,network.floating
{% if cloudkitty_custom_metrics_used %}
metrics_conf = /etc/cloudkitty/{{ cloudkitty_custom_metrics_yaml_file }}
{% endif %}
[keystone_fetcher] [keystone_fetcher]
keystone_version = 3 keystone_version = 3