Output a dynamic inventory

54 views
Skip to first unread message

Juergen Brendel

unread,
Mar 20, 2014, 7:16:28 PM3/20/14
to ansible...@googlegroups.com
Hello!

I have a playbook, which dynamically creates hosts on Amazon EC2 and (also dynamically) adds them to various groups.

Ideally, I would like to be able to revisit these hosts on a second run, just in case something went wrong with one of those hosts, or I want to change something.

Therefore, I'm wondering if there is a preferred way to output (dump) the current state of the dynamic inventory. Is there a module for it or do I have to use a local_action, run my groups through a template and generate an inventory file in that manner?

Thank you for your help...

Jesse Keating

unread,
Mar 21, 2014, 1:24:58 AM3/21/14
to ansible...@googlegroups.com
On 3/20/14, 4:16 PM, Juergen Brendel wrote:
>
> Therefore, I'm wondering if there is a preferred way to output (dump)
> the current state of the dynamic inventory. Is there a module for it or
> do I have to use a local_action, run my groups through a template and
> generate an inventory file in that manner?

I don't believe there is a built in way to do what you want. A
local_action with a template is the way to go.


-jlk

Michael DeHaan

unread,
Mar 21, 2014, 9:05:58 AM3/21/14
to ansible...@googlegroups.com
"
Ideally, I would like to be able to revisit these hosts on a second run, just in case something went wrong with one of those hosts,"

The way to do this is to call some basic script tests to verify that your service is running by the time your playbooks complete, such that the playbooks fail for those hosts.

Then the generated retry file can be used to selectively target just the hosts that fail.






--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/532BCD2A.9060408%40j2solutions.net.

For more options, visit https://groups.google.com/d/optout.

Juergen Brendel

unread,
Mar 21, 2014, 5:47:24 PM3/21/14
to ansible...@googlegroups.com

Hello!

On Fri, 2014-03-21 at 09:05 -0400, Michael DeHaan wrote:

> The way to do this is to call some basic script tests to verify that
> your service is running by the time your playbooks complete, such that
> the playbooks fail for those hosts.
>
>
> Then the generated retry file can be used to selectively target just
> the hosts that fail.
>
>
Yes, that would work. Thank you for your response.

In the meantime, I've gone the route of generating a full inventory file
via a template. Fortunately, that's easy enough. That way, I can use
this inventory also for further configuration management tasks for which
maybe I have other playbooks.

Thank you again...

Juergen
Reply all
Reply to author
Forward
0 new messages