mongosb - move secret to dedicated file
This commit is contained in:
parent
ff0533ecd3
commit
f86870ec3a
@ -38,6 +38,16 @@
|
||||
notify:
|
||||
- 'prometheus | mongodb exporter | restart service'
|
||||
|
||||
- name: 'prometheus | mongodb exporter | configuration'
|
||||
template:
|
||||
src: conf/mongodb-exporter.conf.j2
|
||||
dest: /etc/mongodb-exporter.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
notify:
|
||||
- 'prometheus | mongodb exporter | restart service'
|
||||
|
||||
- name: 'prometheus | mongodb exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
|
6
templates/conf/mongodb-exporter.conf.j2
Normal file
6
templates/conf/mongodb-exporter.conf.j2
Normal file
@ -0,0 +1,6 @@
|
||||
# {{ ansible_managed }}
|
||||
{% if (prometheus_mongodb_exporter_user is defined) and (prometheus_mongodb_exporter_pass is defined) %}
|
||||
MONGODB_URI=mongodb://{{ prometheus_mongodb_exporter_user }}:{{ prometheus_mongodb_exporter_pass }}@{{ prometheus_mongodb_exporter_host|default("localhost") }}:{{ prometheus_mongodb_exporter_port|default("27017") }}/{{ prometheus_mongodb_exporter_database|default("admin") }}
|
||||
{% else %}
|
||||
MONGODB_URI=mongodb://{{ prometheus_mongodb_exporter_host|default("localhost") }}:{{ prometheus_mongodb_exporter_port|default("27017") }}/{{ prometheus_mongodb_exporter_database|default("admin") }}
|
||||
{% endif %}
|
@ -4,11 +4,8 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
{% if (prometheus_mongodb_exporter_user is defined) and (prometheus_mongodb_exporter_pass is defined) %}
|
||||
ExecStart=/usr/local/bin/prometheus-mongodb-exporter --mongodb.uri=mongodb://{{ prometheus_mongodb_exporter_user }}:{{ prometheus_mongodb_exporter_pass }}@{{ prometheus_mongodb_exporter_host|default("localhost") }}:{{ prometheus_mongodb_exporter_port|default("27017") }}/{{ prometheus_mongodb_exporter_database|default("admin") }}
|
||||
{% else %}
|
||||
ExecStart=/usr/local/bin/prometheus-mongodb-exporter --mongodb.uri=mongodb://{{ prometheus_mongodb_exporter_host|default("localhost") }}:{{ prometheus_mongodb_exporter_port|default("27017") }}/{{ prometheus_mongodb_exporter_database|default("admin") }}
|
||||
{% endif %}
|
||||
ExecStart=/usr/local/bin/prometheus-mongodb-exporter
|
||||
EnvironmentFile=/etc/mongodb-exporter.conf
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
Loading…
x
Reference in New Issue
Block a user