Hi everyone,
I am currently writing some Ansible roles and playbooks to setup an AWS infrastructure and then to deploy apps/databases.
The issue I have is that I want to create some EC2 instances during the first stage of the playbook (“AWS infrastructure”), and provision those EC2 instances in the 2nd stage of the playbook (“deployment”). The first stage only applies to “localhost”, while the 2nd stage would apply to an inventory of hosts created during the 1st stage.
Obviously, I could have two playbooks, one for each stage. The 2nd stage would use the “ec2.py” dynamic inventory script to list the EC2 instances created by the first playbook.
However, I would like to keep it to one playbook if at all possible. Is is possible for Ansible to have the inventory updated in the middle of a playbook?
Thanks a lot for any help!