diff --git a/README.md b/README.md new file mode 100644 index 0000000..db736f5 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Summary + +This provide a basic ansible role to deploy the prometheus node exporter. + +Please note, this is not the most flexible role but fits well into my infrastructure. More +configurations can be added easyly. Get in touch! + +## Configuration + +In order to use this role, you need to provide the following configuration: + +### `node_exporter_domain` + +This is the domain serving the API. + +### `node_exporter_cert` + +This specifies which domain should be used for SSL. Useful if you use wildcard +certs. These are expected to live in `/etc/nginx/certs`. + +### `prometheus_pass` + +This specifies the HTTP Basic Auth password to secure the prometheus endpoint. + diff --git a/files/nginx.conf b/files/nginx.conf index ec73523..1a2631b 100644 --- a/files/nginx.conf +++ b/files/nginx.conf @@ -1,10 +1,10 @@ server { listen 443 ssl http2; listen [::]:443 ssl http2; - server_name tech.ag-link.xyz; + server_name {{ node_exporter_domain }}; - ssl_certificate /etc/nginx/certs/ag-link.xyz/fullchain; - ssl_certificate_key /etc/nginx/certs/ag-link.xyz/key; + ssl_certificate /etc/nginx/certs/{{ node_exporter_cert }}/fullchain; + ssl_certificate_key /etc/nginx/certs/{{ node_exporter_cert }}/key; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; @@ -23,6 +23,6 @@ server { listen 80; listen [::]:80; server_name tech.ag-link.xyz; - return 301 https://tech.ag-link.xyz$request_uri; + return 301 https://{{ node_exporter_domain }}$request_uri; } diff --git a/tasks/main.yml b/tasks/main.yml index e240147..212870e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,7 +15,7 @@ become: yes copy: src: files/nginx.conf - dest: /etc/nginx/conf.d/tech.ag-link.xyz.conf + dest: /etc/nginx/conf.d/{{ prometheus_domain }} notify: Check and Reload nginx - name: Install apache2-utils