-
Notifications
You must be signed in to change notification settings - Fork 175
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
feat: ara_playbook_labels from inventory-vars #581
Comments
I understand that these labels are not host-specific, but specific to the execution. |
PR: #582 |
Hi and thanks for the issue. There has been discussions about this kind of feature in the past and whether we would do like the PR #582 suggests or introduce something like host labels. For the use cases we had discussed at the time, it made more sense to have Ansible set a custom fact for the hosts and then have ara pick them up naturally like every other fact. The answer depends on the use case so I would be curious to know about yours. By having Ansible set a custom fact the operation is done once when running a playbook, then picked up automatically with every other fact when running the setup module or gather_facts. By taking an approach where we want it to be a label set via an inventory variable, we take an approach like the one suggested in the PR where we have to iterate across every host, then look up if the variable exist, many times per playbook (once per play?). This operation is expensive in terms of performance and scales terribly when running across large playbooks with a lot of hosts. We generally try to keep the "computing" that ara's ansible callback does to a minimum in order to have the smallest possible performance overhead. |
What is the issue ?
It seems this might be feature-request as the current handling of
ara_playbook_labels
does not handlehostvars
aka inventory-vars.We try to pass some inventory-specific & group-specific labels to the ARA-client.
To ensure these are set as expected - we assert it inside our playbook:
But when I check-out the
play_vars
- the variable is not set?At: https://github.com/ansible-community/ara/blob/master/ara/plugins/callback/ara_default.py#L511
It Prints:
When in the play_vars - the variable exists. But it seems to be nested under
hostvars
.What should be happening ?
The documentation does only mention variables that are set in the playbook-context. But as Ansible allows also to set this variable in other ways - I would have expected it to work either way.
Two solutions come to my mind:
ara_playbook_labels
- I might supply a PR that enables this behaviourThe text was updated successfully, but these errors were encountered: