From 18403fbb6e0e95259347836ab32250491b3cf014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Fri, 19 Jan 2024 12:54:14 +0000 Subject: [PATCH] Add conditional dependency between enable_charts and provision_prometheus --- README.md | 4 ++-- playbook.yml | 4 +--- roles/containers/defaults/main.yml | 1 - roles/containers/tasks/main.yml | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ca86049..6fed7c1 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ These variables are the defaults of our roles, if you want to override the prope | provision_postgres | Run the postgres provisioning contained into postgres role, set to false if you provide an external postgres to the services | "true" | | provision_rabbitmq | Run the rabbitmq provisioning contained into rabbitmq role, set to false if you provide an external rabbitmq to the services | "true" | | provision_proxy | Run the nginx provisioning for exposing all the services, se to false if you don't want to expose the services or you have already in place a reverse proxy infrastructure | "true" | -| provision_prometheus | Run the prometheus provisioning used by trento to store metrics send by agents | "true" | +| provision_prometheus | Run the prometheus provisioning used by trento to store metrics send by agents | true when enable_charts is true or undefined | | docker_network_name | Name of the docker network interface | trentonet | | web_container_image | Name of the Web container image to use to create the container | ghcr.io/trento-project/trento-web:rolling | | web_container_name | Name of the Web container | trento_web | @@ -281,7 +281,7 @@ These variables are the defaults of our roles, if you want to override the prope | nginx_vhost_http_listen_port | Configure the http listen port for trento (redirects to https by default) | 80 | | nginx_vhost_https_listen_port | Configure the https listen port for trento | 443 | | enable_api_key | Enable/Disable API key usage. Mostly for testing purposes | true | -| enable_charts | Enable/Disable charts display based on Prometheus metrics | true | +| enable_charts | Enable/Disable charts display based on Prometheus metrics | true when provision_prometheus is true or undefined | | web_upstream_name | Web nginx upstream name | web | | wanda_upstream_name | Wanda nginx upstream name | wanda | | amqp_protocol | Change the amqp protocol type | amqp | diff --git a/playbook.yml b/playbook.yml index 9b94453..96db747 100644 --- a/playbook.yml +++ b/playbook.yml @@ -53,12 +53,10 @@ - name: Provision prometheus become: true - vars: - provision_prometheus: "true" hosts: prometheus-hosts roles: - role: prometheus - when: provision_prometheus == 'true' + when: provision_prometheus | default(enable_charts | default('true')) == 'true' become: true - name: Provision rabbitmq diff --git a/roles/containers/defaults/main.yml b/roles/containers/defaults/main.yml index 4c564ca..49aba3f 100644 --- a/roles/containers/defaults/main.yml +++ b/roles/containers/defaults/main.yml @@ -27,6 +27,5 @@ refresh_token_secret: "lookup('community.general.random_string', base64=True, le web_admin_username: admin enable_alerting: "false" enable_api_key: "true" -enable_charts: "true" amqp_protocol: amqp prometheus_url: "http://host.docker.internal:9090" diff --git a/roles/containers/tasks/main.yml b/roles/containers/tasks/main.yml index 6632d6d..fbe7054 100644 --- a/roles/containers/tasks/main.yml +++ b/roles/containers/tasks/main.yml @@ -85,4 +85,4 @@ ADMIN_USER: "{{ web_admin_username }}" ADMIN_PASSWORD: "{{ web_admin_password }}" ENABLE_API_KEY: "{{ enable_api_key }}" - CHARTS_ENABLED: "{{ enable_charts }}" + CHARTS_ENABLED: "{{ enable_charts | default(provision_prometheus | default('true')) }}"