Hello list,
I think I’m seeing “group_vars/all” get skipped for implicit localhost when using the ec2.py inventory script. I’ve tried writing a few simplified example plays but they all worked, so I’m either missing something obvious or the issue was in a part I tried to stub out. So here is what I hope will be a succinct verbal description instead…
I’m working on an ec2 deployment that has a few playbooks that are run by separate calls to ansible-playbook, via a pretty simple bash wrapper script. The first call to ansible-playbook creates the ec2 instances pretty normally, getting vars like account credentials and instance type from group_vars/all. Then we return to our bash wrapper which does a bunch of work while the instances start, and then makes a separate call to ansible-playbook (this time using -i ec2.py) that configures the instances. It is in this second call to ansible-playbook that I’m getting errors that my vars to access ec2 are not defined.
I think the culprit is in using a dynamic inventory because I tried specifying ec2.py for the first (instance creation) ansible-playbook call too, and it also started failing saying vars were undefined.
This is roughly what the bash script is doing at the time:
Request the instances, don’t wait for them
ansible-playbook -f 25 create_instances.yml --private-key=key -e “stuff like fqdn of site, server-group name, etc, wait=no”
#prep composer and npm type dependencies on build server while waiting for instances
ec2.py --refresh-cache &>/dev/nullProvision instances in their respective roles
ansible-playbook -f 25 -i ec2.py provision_instances.yml --private-key=key -e “stuff like fqdn of site, server-group name, etc, wait=yes”
Any insights much appreciated.
Thank you,
Mark