add certificates to node exporters

This commit is contained in:
histausse 2021-09-21 16:16:02 +02:00
parent 435e834764
commit 569c9df319
Signed by: histausse
GPG key ID: 67486F107F62E9E9

View file

@ -10,12 +10,6 @@
retries: 3 retries: 3
until: apt_result is succeeded until: apt_result is succeeded
# TODO: add auth
#
# Create the file --web.config=/etc/node_exporter/config.yaml
# and add --web.config=/etc/node_exporter/config.yaml to
# the args in /etc/default/prometheus-node-exporter
- name: Ensure /etc/node_exporter exist - name: Ensure /etc/node_exporter exist
file: file:
path: /etc/node_exporter path: /etc/node_exporter
@ -33,6 +27,24 @@
mode: u=rw,g=r,o=r mode: u=rw,g=r,o=r
notify: Restart prometheus-node-exporter notify: Restart prometheus-node-exporter
- name: Generate certificate
include_role:
name: generate-cert
vars:
directory: /etc/node_exporter/
cname: "node-exp-{{ lan_address }}"
owner: prometheus
group: prometheus
key_mode: u=rw,g=,o=
subject_alt_name: "IP:{{ lan_address }}"
notify: Restart prometheus-node-exporter
- name: Copy the CA cert
copy:
content: "{{ ca_cert }}"
dest: /etc/node_exporter/ca.crt
notify: Restart prometheus-node-exporter
- name: Setup the arguments for node-exporter - name: Setup the arguments for node-exporter
template: template:
src: prometheus-node-exporter src: prometheus-node-exporter
@ -45,8 +57,8 @@
args: args:
- name: web.listen-address - name: web.listen-address
value: "{{ lan_address }}:9100" value: "{{ lan_address }}:9100"
# - name: web.config - name: web.config
# value: /etc/node_exporter/config.yaml value: /etc/node_exporter/config.yaml
# Add the node to the server targets # Add the node to the server targets