I am trying to use the following json file as input to ansible host inventory but I get error when I run the playbook. JSON File:
{
"instances":{
"host": 10.66.70.33
}
}
Playbook:
hosts: "{{ instances.host }}"
remote_user: root #vars:
When I run the play book I get the following errors. I am not sure where I am doing wrong. I am new to Ansible. Please advice I guess i am doing some silly mistake.
[WARNING]: Could not match supplied host pattern, ignoring: all [WARNING]: provided hosts list is empty, only localhost is available ERROR! The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'instances' is undefined
I am running the playbook as follows:
ansible-playbook -i <path>/test.json <path>test_playbook.yml