Stavo cercando di capire come eseguire il provisioning di un host da ec2, attendere che ssh venga visualizzato e quindi eseguire il mio playbook contro di esso. Che è fondamentalmente lo stesso caso d'uso che hai. Ho finito con il seguente:
- name: Provision App Server from Amazon
hosts: localhost
gather_facts: False
tasks:
# #### call ec2 provisioning tasks here ####
- name: Add new instance to host group
add_host: hostname="{{item.private_ip}}" groupname="appServer"
with_items: ec2.instances
- name: Configure App Server
hosts: appServer
remote_user: ubuntu
gather_facts: True
tasks: ----configuration tasks here----
penso che la terminologia ansible è che ho due commedie in un playbook, ciascuno operante su un diverso gruppo di host (localhost, e il gruppo appserver)
fonte
2015-11-12 20:08:49