From cb6a054b2649f7228ed8c35e8b257dce8fc24e30 Mon Sep 17 00:00:00 2001 From: Igor Ribeiro Barbosa Duarte Date: Tue, 17 Sep 2024 15:34:40 -0300 Subject: [PATCH] ansible-scylla-monitoring: Always look for the prometheus_rules_file in scylla_monitoring_role_config_path This patch adds a 'scylla_monitoring_role_config_path' var which defaults to "{{ inventory_path }}" and defines that the monitoring role should always look for the prometheus_rules_file in the path defined in this var. --- ansible-scylla-monitoring/defaults/main.yml | 4 ++++ ansible-scylla-monitoring/tasks/common.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ansible-scylla-monitoring/defaults/main.yml b/ansible-scylla-monitoring/defaults/main.yml index 6e91d9ee..bfd7809a 100644 --- a/ansible-scylla-monitoring/defaults/main.yml +++ b/ansible-scylla-monitoring/defaults/main.yml @@ -20,6 +20,9 @@ scylla_manager_ip: '127.0.0.1' # Download the scylla-monitoring from here scylla_monitoring_archive_url: 'https://github.com/scylladb/scylla-monitoring/archive/scylla-monitoring-3.10.1.tar.gz' +# The path where the role will look for config files +scylla_monitoring_role_config_path: "{{ inventory_dir }}" + scylla_monitoring_deploy_path: /opt/scylla-monitoring scylla_monitoring_data_path: "{{ scylla_monitoring_deploy_path }}/data" scylla_monitoring_config_path: "{{ scylla_monitoring_deploy_path }}/config" @@ -49,6 +52,7 @@ use_nodetool_status_with_genconfig: false # is always installed. # If below value is different from 'default' a corresponding file is going to be installed as 'userdefined.rules.yml' # in scylla_monitoring_prom_rules_path folder. +# The value should be a file path relative to 'scylla_monitoring_role_config_path'. prometheus_rules_file: default # Reject filter for alerts in the prometheus.rules.yml that comes as part of the Monitoring distribution. diff --git a/ansible-scylla-monitoring/tasks/common.yml b/ansible-scylla-monitoring/tasks/common.yml index 3fb75fce..6a6ee1f5 100644 --- a/ansible-scylla-monitoring/tasks/common.yml +++ b/ansible-scylla-monitoring/tasks/common.yml @@ -125,7 +125,7 @@ - name: set prometheus rules file from preset file copy: - src: "{{ prometheus_rules_file }}" + src: "{{ scylla_monitoring_role_config_path }}/{{ prometheus_rules_file }}" dest: "{{ scylla_monitoring_prom_rules_path }}/userdefined.rules.yml" mode: '0644' when: prometheus_rules_file is defined and prometheus_rules_file != 'default'