mongosb - move secret to dedicated file
This commit is contained in:
parent
ff0533ecd3
commit
f86870ec3a
@ -38,6 +38,16 @@
|
|||||||
notify:
|
notify:
|
||||||
- 'prometheus | mongodb exporter | restart service'
|
- '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'
|
- name: 'prometheus | mongodb exporter | configure systemd to use service'
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: yes
|
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]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
{% if (prometheus_mongodb_exporter_user is defined) and (prometheus_mongodb_exporter_pass is defined) %}
|
ExecStart=/usr/local/bin/prometheus-mongodb-exporter
|
||||||
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") }}
|
EnvironmentFile=/etc/mongodb-exporter.conf
|
||||||
{% 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 %}
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user