Hi,
I am facing a little problem and I don’t find a clear solution
I need to provision a new EC2 (AWS) instance and configure it.
During the configuration I use some variables from the inventory script ec2.py
So I tried two approaches:
- I executed two different playbooks under a shell script
¦ - ansible-playbook create_ec2.yml
¦ - ansible-playbook configure_ec2.yml
¦ This approach works but I use a shell script which execute two ansible scripts
- I execute a meta playbook (which include create_ec2.yml then configure_ec2.yml)
¦ - ansible-playbook meta_ec2.yml
¦ This approach fail because it doesn’t know variable like ec2_private_ip_address from ec2.py
¦ So I tried different thinks to get those variables, add
¦ ¦ ‘’’ - name: Refresh AWS Cache
¦ ¦ ¦ - command: inventory.d/ec2.py --refresh-cache
¦ ¦ ‘’’
¦ ¦ ¦ - name: gathering ec2 facts
¦ ¦ ¦ ¦ ec2_facts:
¦ ¦ ‘’’
¦ But none of them work
Is anyone has an advice?