Is it possible to refresh inventory during ansible playbook execution?
I create AWS objects (VPC, subnets, security groups etc.) from scratch with playbook which uses plugin
amazon.aws.aws_ec2 for dynamic host inventory.
When I run playbook, instances do not exist yet. Later I want to connect to freshly created instances, but ansible does not know about them.
I can run two playbooks consecutively in a script, then second one would query AWS and see instances, but is there a better way?
After your hosts are created by your playbook, run the following task before using them elsewhere in a consecutive play:
- name: Refresh inventory from existing sources