amazon web services - Ansible use ec2 public ip of one play in another play -


i have following ansible playbook.

---  - name: ansible playbook create new aws dev instance   hosts: localhost   roles:     - aws  - name: set dev server   hosts:    roles:     - services 

in aws role, creating ec2 instance , registering ec2_instance. how use public ip of newly created instance in hosts of second play.

should use hosts: ec2_instance.public_ip?

you may consider using add_host. put in first play (after getting ip of new vm):

- name: adding new host in inventory file.   add_host: name=somename ansible_ssh_host="{{your_ip}}" ansible_ssh_pass=*** groups=new_group 

and use group in second play:

- name: set dev server   hosts: new_group 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -