Yes you can use the add_host module to create an in-memory group. I am
having weird issues with EC2 instances that I just posted about (
https://groups.google.com/forum/#!topic/ansible-project/jqRDPGqUof8) but I
am able to run 2 commands on the newly provisioned hosts.
You need something like this using a registered ec2 variable from
provisioning:
- name: Add all instance public IPs to in-memory group
add_host:
name: "{{ item.1.public_ip }}"
groups: ec2hosts
with_subelements:
- "{{ ec2.results }}"
- instances
and then you'd be able to use that group in another hosts section of your
play:
- hosts: ec2hosts
user: ubuntu
gather_facts: false
On Monday, November 13, 2017 at 11:17:47 AM UTC-7, Jeff Parrish wrote:
>
> I'm trying to start a marketplace instance and secure it all in the same
> playbook. That requires copying some files and running a provisioning
> script. I'd prefer to keep all that in a single playbook, to reduce chances
> of error and keep it semi-atomic. It doesn't seem to be possible even with
> the dynamic inventory capability, since the state of the system is
> determined at the beginning of the playbook, and there is no way I can see
> to otherwise indicate the target host for the copy and script modules.
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/42a8474f-0ed4-4cc7-8c42-1207f000c4ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.