|
13 | 13 | environment: "{{ openstack_auth_env }}" |
14 | 14 | delegate_to: localhost |
15 | 15 | register: credential_check |
| 16 | + run_once: true |
16 | 17 |
|
17 | 18 | - name: Create ec2 credential if there's none |
18 | 19 | command: > |
|
21 | 22 | --format json |
22 | 23 | environment: "{{ openstack_auth_env }}" |
23 | 24 | delegate_to: localhost |
| 25 | + run_once: true |
24 | 26 | when: "{{ credential_check.stdout == [] }}" |
25 | 27 |
|
26 | 28 | - name: Query ec2 credential for admin |
|
31 | 33 | environment: "{{ openstack_auth_env }}" |
32 | 34 | delegate_to: localhost |
33 | 35 | register: credential |
| 36 | + run_once: true |
34 | 37 |
|
35 | 38 | - name: Get object storage endpoint |
36 | 39 | command: > |
|
40 | 43 | environment: "{{ openstack_auth_env }}" |
41 | 44 | delegate_to: localhost |
42 | 45 | register: endpoint |
| 46 | + run_once: true |
43 | 47 |
|
44 | 48 | - name: Ensure radosgw_usage_exporter container is running |
45 | 49 | community.docker.docker_container: |
|
57 | 61 | radosgw_server: "{{ host.URL | regex_replace('(https?://)([^:/]+):([0-9]+)/.*', '\\1\\2:\\3') }}" # Drop Swift api address |
58 | 62 | become: true |
59 | 63 |
|
60 | | - - name: Get target ip addresses |
| 64 | + - name: Get Prometheus target ip addresses of RADOS gateway usage exporters |
61 | 65 | set_fact: |
62 | 66 | prometheus_targets: "{{ prometheus_targets | default([]) +[( internal_net_name | net_ip( item ) + ':9242' )] }}" |
63 | 67 | loop: "{{ groups['monitoring'] }}" |
| 68 | + run_once: true |
64 | 69 |
|
65 | | - - name: Ensure radosgw_usage_exporter is targeted by prometheus-server |
66 | | - blockinfile: |
67 | | - path: /etc/kolla/prometheus-server/prometheus.yml |
68 | | - block: | |
69 | | - - honor_labels: true |
70 | | - job_name: ceph_radosgw_usage_exporter |
| 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 |
71 | 79 | scrape_interval: 15s |
72 | 80 | static_configs: |
73 | 81 | - targets: |
|
80 | 88 | separator: "" |
81 | 89 | regex: (.+) |
82 | 90 | replacement: ${1} |
83 | | - become: true |
| 91 | + run_once: true |
84 | 92 |
|
85 | | - - name: Restart prometheus-server |
86 | | - ansible.builtin.command: |
87 | | - cmd: systemctl restart kolla-prometheus_server-container |
88 | | - become: true |
|
0 commit comments