I have a playbook that reads in a custom config file and creates a valid Ansible inventory in YAML then continues with other Ansible roles. The problem is when I specify the not-yet-created hosts file in my ansible.cfg, it only reads the file in the beginning so when I want to continue with my tasks, I get a "provided hosts list is empty" warning. Is there a way I can get the inventory file to "reload"? I attempted a dynamic inventory script in python, but the syntax is more complicated then the simple static YAML or INI configuration.
0
votes
1 Answers
0
votes
Use a meta
task:
- meta: refresh_inventory
Docs: https://docs.ansible.com/ansible/latest/modules/meta_module.html