Ajout authentification et tls sur nodeexporter
This commit is contained in:
parent
0bb2d79fc2
commit
0ab582daa1
3 changed files with 16 additions and 5 deletions
|
@ -1 +1,2 @@
|
||||||
docker_nodeexporter_port: "9100"
|
docker_nodeexporter_port: "9100"
|
||||||
|
docker_nodeexporter_enable_tlsauth: false
|
||||||
|
|
|
@ -3,13 +3,17 @@
|
||||||
path: /opt/{{ docker_nodeexporter_service_id }}/
|
path: /opt/{{ docker_nodeexporter_service_id }}/
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Prepare config
|
- name: Prepare docker-compose.yml
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item }}"
|
src: docker-compose.yml
|
||||||
dest: /opt/{{ docker_nodeexporter_service_id }}/
|
dest: /opt/{{ docker_nodeexporter_service_id }}/
|
||||||
with_items:
|
notify: docker-compose-up
|
||||||
- docker-compose.yml
|
|
||||||
- config.yml
|
- name: Prepare config.yml
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: config.yml
|
||||||
|
dest: /opt/{{ docker_nodeexporter_service_id }}/
|
||||||
|
when: docker_nodeexporter_enable_tlsauth
|
||||||
notify: docker-compose-up
|
notify: docker-compose-up
|
||||||
|
|
||||||
- name: Copie le certificat pour tls
|
- name: Copie le certificat pour tls
|
||||||
|
@ -23,6 +27,7 @@
|
||||||
group: root
|
group: root
|
||||||
notify:
|
notify:
|
||||||
- docker-compose-up
|
- docker-compose-up
|
||||||
|
when: docker_nodeexporter_enable_tlsauth
|
||||||
|
|
||||||
- name: Copie la clé pour tls
|
- name: Copie la clé pour tls
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
|
@ -35,3 +40,4 @@
|
||||||
group: root
|
group: root
|
||||||
notify:
|
notify:
|
||||||
- docker-compose-up
|
- docker-compose-up
|
||||||
|
when: docker_nodeexporter_enable_tlsauth
|
||||||
|
|
|
@ -8,15 +8,19 @@ services:
|
||||||
- /proc:/host/proc:ro
|
- /proc:/host/proc:ro
|
||||||
- /sys:/host/sys:ro
|
- /sys:/host/sys:ro
|
||||||
- /:/rootfs:ro
|
- /:/rootfs:ro
|
||||||
|
{% if docker_nodeexporter_enable_tlsauth %}
|
||||||
- ./config.yml:/config.yml
|
- ./config.yml:/config.yml
|
||||||
- ./key.pem:/key.pem
|
- ./key.pem:/key.pem
|
||||||
- ./cert.pem:/cert.pem
|
- ./cert.pem:/cert.pem
|
||||||
|
{% endif %}
|
||||||
command:
|
command:
|
||||||
- '--path.procfs=/host/proc'
|
- '--path.procfs=/host/proc'
|
||||||
- '--path.rootfs=/rootfs'
|
- '--path.rootfs=/rootfs'
|
||||||
- '--path.sysfs=/host/sys'
|
- '--path.sysfs=/host/sys'
|
||||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc|run)($$|/)'
|
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc|run)($$|/)'
|
||||||
|
{% if docker_nodeexporter_enable_tlsauth %}
|
||||||
- '--web.config.file=/config.yml'
|
- '--web.config.file=/config.yml'
|
||||||
|
{% endif %}
|
||||||
restart: always
|
restart: always
|
||||||
labels:
|
labels:
|
||||||
org.label-schema.group: "monitoring"
|
org.label-schema.group: "monitoring"
|
||||||
|
|
Loading…
Reference in a new issue