From 37f78f831c005d606bc1399ae3eab6ddd172d256 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 10 Jan 2023 19:58:16 +0100 Subject: [PATCH] Fix the nginx configuration. --- defaults/main.yml | 20 ++++++++++++++++++++ vars/main.yml | 23 ++++------------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index cef0386..e9aa775 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,3 +13,23 @@ prometheus_loglevel: info prometheus_http_port: 9090 prometheus_opts: '--storage.tsdb.retention.time=120d' # --storage.tsdb.retention.size=512GB + +prometheus_nginx_letsencrypt_managed: true +prometheus_nginx_virthost_name: "{{ ansible_fqdn }}" +prometheus_nginx_server_name: "{{ ansible_fqdn }}" +prometheus_nginx_virthosts: + - virthost_name: '{{ prometheus_nginx_virthost_name }}' + listen: '{{ http_port }}' + server_name: '{{ prometheus_nginx_server_name }}' + server_aliases: '' + index: index.html + ssl_enabled: true + ssl_only: true + ssl_letsencrypt_certs: '{{ nginx_letsencrypt_managed }}' + root: '{{ nginx_webroot }}' + server_tokens: 'off' + proxy_standard_setup: True + locations: + - location: / + target: http://localhost:{{ prometheus_http_port }} + diff --git a/vars/main.yml b/vars/main.yml index 0b54f43..48a5acb 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,21 +1,6 @@ --- -prometheus_dir: 'prometheus-{{ prometheus_version }}.linux-amd64' -prometheus_file: '{{ prometheus_dir }}.tar.gz' +prometheus_dir: "prometheus-{{ prometheus_version }}.linux-amd64" +prometheus_file: "{{ prometheus_dir }}.tar.gz" -nginx_letsencrypt_managed: True -nginx_use_common_virthost: True -nginx_virthosts: - - virthost_name: '{{ ansible_fqdn }}' - listen: '{{ http_port }}' - server_name: '{{ ansible_fqdn }}' - server_aliases: '' - index: index.html - ssl_enabled: True - ssl_only: True - ssl_letsencrypt_certs: '{{ nginx_letsencrypt_managed }}' - root: '{{ nginx_webroot }}' - server_tokens: 'off' - proxy_standard_setup: True - locations: - - location: / - target: http://localhost:{{ prometheus_http_port }} +nginx_letsencrypt_managed: "{{ prometheus_nginx_letsencrypt_managed }}" +nginx_virthosts: "{{ prometheus_nginx_virthosts }}"