Discussion:
[ansible-project] Programmatically checking if a particular host is still a target.
j***@ioctl.org
2015-07-30 15:20:05 UTC
Permalink
So I've a situation where I want to delegate_to a host. That host is one
(arbitrarily chosen) of a group.

Rather than

delegate_to: "{{ GROUP[0] }}"

I'd like to confirm that the host is actually up, first - or rather, pick
an arbitrary member of GROUP that's successfully had facts gathered
against it (and no previous play fail on it).

Is that kind of status derivable from any of the information that ansible
currently exposes as a variable to the J2 engine? (Or any other way: if I
need to write a custom filter for this job I have no objection to doing
so.)


Cheers,
jan
--
***@ioctl.org http://ioctl.org/jan/ Short, dark, ugly: pick any three
Goedel would be proud - I'm both inconsistent _and_ incomplete.
KSS
2015-07-30 15:54:35 UTC
Permalink
I think this may help;

{{ play_hosts[0] }}

That should pick the first host in the current play (so no previous
failures)
Post by j***@ioctl.org
So I've a situation where I want to delegate_to a host. That host is one
(arbitrarily chosen) of a group.
Rather than
delegate_to: "{{ GROUP[0] }}"
I'd like to confirm that the host is actually up, first - or rather, pick
an arbitrary member of GROUP that's successfully had facts gathered
against it (and no previous play fail on it).
Is that kind of status derivable from any of the information that ansible
currently exposes as a variable to the J2 engine? (Or any other way: if I
need to write a custom filter for this job I have no objection to doing
so.)
Cheers,
jan
--
pick any three
Goedel would be proud - I'm both inconsistent _and_ incomplete.
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/095bae30-8720-4bb0-ab66-eb2b4886feea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...