On Tue, Nov 13, 2018 at 5:37 PM Brian Coca <bc...@redhat.com> wrote:

> 1 play before your normal play:
>
>
> hosts: hosta,hostb
> gather_facts: False
> tasks:
>    - ping:
>    - group_by: key=rechable
>
> hosts: reachable
> ....
>
> ----------
> Brian Coca
>

Thanks for mentioning the 'ping' module - that is new to me.  (It checks
ssh connection and python, not an icmp ping)
But I don't see "reachable" as a return value in the docs.

Looks like that will run it for both hosts, which is not what the requestor
wanted.  More like:

hosts: hosta
gather_facts: False
tasks:
   - ping:
     register: pingtest
   - hosts: hostb
     when: pingtest.failed

But so far I cannot get it to work.

I am looking to use the same logic to connect to the internal or external
IP of an AWS server depending on where I happen to be running Ansible at
that moment.

-- 
Bob Harold

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to