I normally run playbook like this: ansible-playbook -i live nginx.yml
.
My hosts are defined in live/inventory
and variables are defined in live/group_vars
.
In need to run this playbook on a dynamic IP host where I need to provide IP as an argument in the CLI.
I can achieve it with this syntax: ansible-playbook -i 113.45.97.11, nginx.yml
, however I lose the possibility of loading the -i live
inventory with required variables.
Is there any way to load the variables from live
directory?
I've tried: --extra-vars "@live"
, but then I get
ERROR! an error occurred while trying to read the file '/home/tomek/data/bomcheck-ansible/live': [Errno 21] Is a directory: b'/home/tomek/data/bomcheck-ansible/live'
as it seems it can't read the directory.
What are the options? Basically I am trying to run playbook, along with the variables defined in the inventory, on a host defined dynamically via command line.