diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-10-27 23:05:31 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-10-27 23:05:31 +0200 |
commit | ebaa6201168266393dea9182505275539c297618 (patch) | |
tree | 15ccb94b69c080f4da18af0c35c5ab095e19bfda /roles/monitoring/prometheus/server/tasks/main.yml | |
parent | add filter to generate salts for various password hashes (diff) |
add basic auth to prometheus/server
Diffstat (limited to 'roles/monitoring/prometheus/server/tasks/main.yml')
-rw-r--r-- | roles/monitoring/prometheus/server/tasks/main.yml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/roles/monitoring/prometheus/server/tasks/main.yml b/roles/monitoring/prometheus/server/tasks/main.yml index 1d89fc5a..f5965883 100644 --- a/roles/monitoring/prometheus/server/tasks/main.yml +++ b/roles/monitoring/prometheus/server/tasks/main.yml @@ -95,6 +95,22 @@ validate: "promtool check config %s" notify: reload prometheus +- name: generate web configuration file + when: prometheus_server_auth_users is defined + copy: + content: | + # Ansible managed + basic_auth_users: + {% for user,password in prometheus_server_auth_users.items() %} + {{ user }}: {{ password | password_hash('bcrypt', (user~'@'~inventory_hostname~'/prometheus/server') | bcrypt_salt) }} + {% endfor %} + dest: /etc/prometheus/prometheus-web.yml + mode: 0640 + owner: root + group: prometheus + validate: "promtool check web-config %s" + notify: reload prometheus + - name: generate systemd service unit template: src: prometheus.service.j2 |