|
14 | 14 | delegate_to: localhost
|
15 | 15 | register: credential_check
|
16 | 16 | run_once: true
|
| 17 | + when: stackhpc_enable_radosgw_usage_exporter |
17 | 18 |
|
18 | 19 | - name: Create ec2 credential if there's none
|
19 | 20 | command: >
|
|
23 | 24 | environment: "{{ openstack_auth_env }}"
|
24 | 25 | delegate_to: localhost
|
25 | 26 | run_once: true
|
26 |
| - when: "{{ credential_check.stdout == [] }}" |
| 27 | + when: |
| 28 | + - "{{ credential_check.stdout == [] }}" |
| 29 | + - stackhpc_enable_radosgw_usage_exporter |
27 | 30 |
|
28 | 31 | - name: Query ec2 credential for admin
|
29 | 32 | command: >
|
|
34 | 37 | delegate_to: localhost
|
35 | 38 | register: credential
|
36 | 39 | run_once: true
|
| 40 | + when: stackhpc_enable_radosgw_usage_exporter |
37 | 41 |
|
38 | 42 | - name: Get object storage endpoint
|
39 | 43 | command: >
|
|
44 | 48 | delegate_to: localhost
|
45 | 49 | register: endpoint
|
46 | 50 | run_once: true
|
| 51 | + when: stackhpc_enable_radosgw_usage_exporter |
47 | 52 |
|
48 | 53 | - name: Ensure radosgw_usage_exporter container is running
|
49 | 54 | community.docker.docker_container:
|
|
60 | 65 | host: "{{ endpoint.stdout | from_json | first }}"
|
61 | 66 | radosgw_server: "{{ host.URL | regex_replace('(https?://)([^:/]+):([0-9]+)/.*', '\\1\\2:\\3') }}" # Drop Swift api address
|
62 | 67 | become: true
|
63 |
| - |
64 |
| - - name: Get Prometheus target ip addresses of RADOS gateway usage exporters |
65 |
| - set_fact: |
66 |
| - prometheus_targets: "{{ prometheus_targets | default([]) +[( internal_net_name | net_ip( item ) + ':9242' )] }}" |
67 |
| - loop: "{{ groups['monitoring'] }}" |
68 |
| - run_once: true |
69 |
| - |
70 |
| - - name: Print config to append on prometheus.yml |
71 |
| - debug: |
72 |
| - msg: | |
73 |
| - Add Prometheus target for RADOS gateway usage exporter below at prometheus.yml then reconfigure prometheus_server. |
74 |
| - You can find a template to prometheus.yml at ``ansible/roles/prometheus/templates/prometheus.yml.j2`` under kolla-ansible directory. |
75 |
| - Make sure to use {% raw %} and {% endraw %} tags appropriately on prometheus.yml if you're overriding it for the first time. |
76 |
| -
|
77 |
| - - job_name: ceph_radosgw_usage_exporter |
78 |
| - honor_labels: true |
79 |
| - scrape_interval: 15s |
80 |
| - static_configs: |
81 |
| - - targets: |
82 |
| - {% for item in prometheus_targets %} |
83 |
| - - {{ item }} |
84 |
| - {% endfor %} |
85 |
| - metric_relabel_configs: |
86 |
| - - source_labels: [owner,user] |
87 |
| - target_label: tenant_id |
88 |
| - separator: "" |
89 |
| - regex: (.+) |
90 |
| - replacement: ${1} |
91 |
| - run_once: true |
92 |
| - |
| 68 | + when: stackhpc_enable_radosgw_usage_exporter |
0 commit comments