Skip to content

Commit 3f9d1a2

Browse files
authored
Use variable for prometheus credentials (#115)
1 parent aa8b100 commit 3f9d1a2

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ homestack_monitoring_base_domain: example.com
3939
# renovate: image=prom/prometheus
4040
homestack_monitoring_prometheus_image_version: v2.55.1
4141
# homestack_monitoring_prometheus_base_path: "" # must be set
42+
# homestack_monitoring_prometheus_basic_auth_user: "" # must be set
43+
# homestack_monitoring_prometheus_basic_auth_password: "" # must be set
4244
# renovate: image=grafana/grafana-oss
4345
homestack_monitoring_grafana_image_version: 11.6.5
4446
# homestack_monitoring_grafana_admin_password: "" # must be set

tasks/monitoring.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
mode: "0750"
1212

1313
- name: monitoring | Copy prometheus specific files to their respective directories
14-
ansible.builtin.copy:
14+
ansible.builtin.template:
1515
src: "{{ item }}"
16-
dest: "{{ homestack_monitoring_prometheus_base_path }}/{{ item | basename }}"
16+
dest: "{{ homestack_monitoring_prometheus_base_path }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
1717
owner: "{{ homestack_uid }}"
1818
group: "{{ homestack_gid }}"
1919
mode: "0600"
2020
backup: true
21-
with_fileglob:
22-
- monitoring/prometheus.yml
21+
with_items:
22+
- monitoring/prometheus.yml.j2
2323

2424
- name: monitoring | Ensure grafana directories exist
2525
ansible.builtin.file:
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ scrape_configs:
3232
scrape_interval: 5s
3333
scheme: https
3434
basic_auth:
35-
username: 'prometheus'
36-
password: 'CO&g0HH$ic*CM@8Gta&A'
35+
username: "{{ homestack_monitoring_prometheus_basic_auth_user }}"
36+
password: "{{ homestack_monitoring_prometheus_basic_auth_password }}"
3737
static_configs:
3838
- targets: ['micxer.de:9100']
3939

4040
- job_name: 'omicrontheta-exim4'
4141
scrape_interval: 5s
4242
scheme: https
4343
basic_auth:
44-
username: 'prometheus'
45-
password: 'CO&g0HH$ic*CM@8Gta&A'
44+
username: "{{ homestack_monitoring_prometheus_basic_auth_user }}"
45+
password: "{{ homestack_monitoring_prometheus_basic_auth_password }}"
4646
static_configs:
4747
- targets: ['micxer.de:9636']
4848

@@ -57,8 +57,8 @@ scrape_configs:
5757
# scrape_interval: 5s
5858
# scheme: http
5959
# basic_auth:
60-
# username: 'prometheus'
61-
# password: 'CO&g0HH$ic*CM@8Gta&A'
60+
# username: "{{ homestack_monitoring_prometheus_basic_auth_user }}"
61+
# password: "{{ homestack_monitoring_prometheus_basic_auth_password }}"
6262
# static_configs:
6363
# - targets:
6464
# - 'krikkit:9100'

0 commit comments

Comments
 (0)