bugfix: prometheus update_config didn't reload config

- container isn't restarted always anymore
- added reload by rest api
master
Sven Ketelsen 4 years ago
parent df0e320743
commit 7d211d93ad

@ -17,4 +17,5 @@
uri:
url: "{{ http_s }}://{{ prometheus_id }}.{{ domain }}/-/reload"
method: POST
timeout: 300 # blocks until reload configuration is complete
status_code: 200

@ -4,29 +4,17 @@
### update_config
### update_deployment
- name: "Setup DNS configuration for {{ inventory_hostname }} prometheus"
- name: "Setup DNS configuration for <{{ inventory_hostname }}>"
include_role:
name: sma_digitalocean
tasks_from: domain
vars:
record_data: "{{ stage_server_ip }}"
record_name: "{{ inventory_hostname }}-prometheus"
- name: "Setup DNS configuration for {{ inventory_hostname }} grafana"
include_role:
name: sma_digitalocean
tasks_from: domain
vars:
record_data: "{{ stage_server_ip }}"
record_name: "{{ inventory_hostname }}-grafana"
- name: "Setup DNS configuration for {{ inventory_hostname }} alertmanager"
include_role:
name: sma_digitalocean
tasks_from: domain
vars:
record_data: "{{ stage_server_ip }}"
record_name: "{{ inventory_hostname }}-alertmanager"
record_name: "{{ item }}"
loop:
- "{{ prometheus_id }}"
- "{{ grafana_id }}"
- "{{ alertmanager_id }}"
- name: "Check if {{ inventory_hostname }}/docker-compose.yml exists"
stat:
@ -56,7 +44,7 @@
current_group: "{{ docker_group }}"
current_docker: "{{ prometheus_docker }}"
tags:
- update_config
- update_deployment
- name: "Deploy service templates for {{ inventory_hostname }}"
include_role:
@ -77,12 +65,33 @@
state: present
pull: yes
tags:
- update_config
- update_deployment
- name: "Wait for <{{ http_s }}://{{ prometheus_id }}.{{ domain }}>"
uri:
url: "{{ http_s }}://{{ prometheus_id }}.{{ domain }}"
method: GET
status_code: 200
return_content: yes
register: prometheus_stats
until: prometheus_stats.status == 200
retries: 10
delay: 60
tags:
- update_config
- name: "Reload prometheus configuration"
uri:
url: "{{ http_s }}://{{ prometheus_id }}.{{ domain }}/-/reload"
method: POST
timeout: 300 # blocks until reload configuration is complete
status_code: 200
tags:
- update_config
- name: "Wait for {{ http_s }}://{{ inventory_hostname }}-grafana.{{ domain }}"
uri:
url: "{{ http_s }}://{{ inventory_hostname }}-grafana.{{ domain }}/api/admin/stats"
url: "{{ http_s }}://{{ grafana_id }}.{{ domain }}/api/admin/stats"
url_username: "{{ grafana_admin_username }}"
url_password: "{{ grafana_admin_password }}"
force_basic_auth: yes
@ -96,7 +105,7 @@
- name: Create grafana users
uri:
url: "{{ http_s }}://{{ inventory_hostname }}-grafana.{{ domain }}/api/admin/users"
url: "{{ http_s }}://{{ grafana_id }}.{{ domain }}/api/admin/users"
url_username: "{{ grafana_admin_username }}"
url_password: "{{ grafana_admin_password }}"
force_basic_auth: yes

Loading…
Cancel
Save