Closed vaz-ar closed 3 weeks ago
What does your prometheus_alert_rules_files
variable look like?
This is what I have: /home/<user>/prometheus_cfg/rules/*.rules
, but the loop
version doesn't look there at all, it looks in the directory from which I am running my playbook.
My ansible and collections versions:
❯ ansible --version
ansible [core 2.16.12]
config file = /home/arnaud/.ansible.cfg
configured module search path = ['/home/arnaud/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/arnaud/.virtualenvs/invoke/lib64/python3.12/site-packages/ansible
ansible collection location = /home/arnaud/.ansible/collections:/usr/share/ansible/collections
executable location = /home/arnaud/.virtualenvs/invoke/bin/ansible
python version = 3.12.7 (main, Oct 1 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] (/home/arnaud/.virtualenvs/invoke/bin/python)
jinja version = 3.1.4
libyaml = True
❯ ansible-galaxy collection list
# /home/arnaud/.ansible/collections/ansible_collections
Collection Version
---------------------------------------- -------
ansible.posix 1.6.2
community.crypto 2.22.3
community.docker 4.0.0
community.general 9.5.0
community.grafana 2.1.0
community.hashi_vault 6.2.0
community.library_inventory_filtering_v1 1.0.0
community.vmware 5.0.1
containers.podman 1.15.4
prometheus.prometheus 0.21.0
vmware.vmware 1.6.0
Can you show me exactly how the variable is configured? Wondering if it's perhaps configured as a string and not as a list.
It is declared as a string yes, which was previously working. I will make it a list and check.
I confirm that it works with a list. I think that there should be a check on the type of the variable if it now change the behaviour so wildly if the type is not the one expected.
That should actually be happening, the variable is defined as a list in the argument specs (meta/argument_specs.yml
)
Hello,
Since I updated to the latest available version (0.21.0) I am not able to copy the custom alerting rules to the Prometheus host, as it is looking in the wrong directory and thus tries to validate non rules files using promtools.
The change from using
with_fileglob: "{{ prometheus_alert_rules_files }}"
toloop: "{{ prometheus_alert_rules_files | map('ansible.builtin.fileglob') | flatten }}"
in roles/prometheus/tasks/configure.yml (1e4e4c34156900d427a65430cd3eba805b441851) is the root cause of this, I put back thewith_fileglob
in place of theloop
and it is working fine again.