2020-11-13 10:36:46 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: enable prometheus admin api
|
2021-11-06 08:48:39 +01:00
|
|
|
ansible.builtin.template:
|
2021-11-06 05:22:17 +01:00
|
|
|
src: etc/default/prometheus.j2
|
|
|
|
dest: /etc/default/prometheus
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
vars:
|
|
|
|
prometheus_additional_arguments:
|
2021-11-06 08:52:41 +01:00
|
|
|
"--web.enable-admin-api --web.listen-address=127.0.0.1:9090"
|
2020-11-13 10:36:46 +01:00
|
|
|
notify: restart prometheus
|
|
|
|
|
|
|
|
- name: flush handlers
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.meta: flush_handlers
|
2020-11-13 10:36:46 +01:00
|
|
|
|
|
|
|
- name: wait
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.pause:
|
2020-11-13 10:36:46 +01:00
|
|
|
seconds: 15
|
|
|
|
|
|
|
|
- name: clear prometheus time series database
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.uri:
|
2020-11-13 10:36:46 +01:00
|
|
|
url: http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?match[]=%7B__name__%3D~%22.%2B%22%7D
|
|
|
|
method: POST
|
|
|
|
status_code:
|
|
|
|
- 200
|
|
|
|
- 204
|
|
|
|
|
|
|
|
- name: wait
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.pause:
|
2020-11-13 10:36:46 +01:00
|
|
|
seconds: 5
|
|
|
|
|
|
|
|
- name: disable prometheus admin api
|
2021-11-06 05:22:17 +01:00
|
|
|
ansible.builtin.template:
|
|
|
|
src: etc/default/prometheus.j2
|
|
|
|
dest: /etc/default/prometheus
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2020-11-13 10:36:46 +01:00
|
|
|
notify: restart prometheus
|
|
|
|
|
|
|
|
- name: flush handlers
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.meta: flush_handlers
|