Skip to content

[prometheus.prometheus.prometheus : Copy custom alerting rule files] step is failing #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vaz-ar opened this issue Oct 30, 2024 · 7 comments

Comments

@vaz-ar
Copy link

vaz-ar commented Oct 30, 2024

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 }}" to loop: "{{ prometheus_alert_rules_files | map('ansible.builtin.fileglob') | flatten }}" in roles/prometheus/tasks/configure.yml (1e4e4c3) is the root cause of this, I put back the with_fileglob in place of the loop and it is working fine again.

@gardar
Copy link
Member

gardar commented Oct 30, 2024

What does your prometheus_alert_rules_files variable look like?

@vaz-ar
Copy link
Author

vaz-ar commented Oct 30, 2024

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.

@vaz-ar
Copy link
Author

vaz-ar commented Oct 30, 2024

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

@gardar
Copy link
Member

gardar commented Oct 30, 2024

Can you show me exactly how the variable is configured? Wondering if it's perhaps configured as a string and not as a list.

@vaz-ar
Copy link
Author

vaz-ar commented Oct 30, 2024

It is declared as a string yes, which was previously working.
I will make it a list and check.

@vaz-ar
Copy link
Author

vaz-ar commented Oct 31, 2024

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.

@gardar
Copy link
Member

gardar commented Oct 31, 2024

That should actually be happening, the variable is defined as a list in the argument specs (meta/argument_specs.yml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants