this post was submitted on 11 Jun 2024
4 points (83.3% liked)
Ansible
232 readers
2 users here now
# TODO
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I thought that there might be a way to a custom facts (gather_facts) to all machines, and indicate leader/joiner status there, but I can't get the data to stick.
I think the idea to register the leader status during a dedicated task like Matt said is the better move.
You got this module if you want to create dynamic group during play :
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/add_host_module.html
And during gather_facts, you could add your own custom facts :
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#adding-custom-facts
Bash script example returning json :