Hi,
I have a play in AWX that is running against a group of windows hosts, but I
have a few more hosts that *could* be part of that group but they aren't
always running.
How can I include those hosts in that group, but not have the play marked as
failed if these hosts are offline when the play runs?
Cheers
MH
and related: what is the scope of a dynamic group? if I modify a group from
within a play, are the modifications only visible in that play, or in other
plays in the same workflow as well?
Cheers
MH
Hi,
I had a similar use case and I tried first to ping that host and if it’s not reachable add that to an “unreachable” group. Then exclude that group from all other plays.
Here’s an example:
- name: Check if hosts are reachable
hosts: all
gather_facts: false
tasks:
-
name: ping host
ping:
register: _check_ping
ignore_unreachable: true
-
name: add unreachable hosts to new group
add_host:
name: “{{ inventory_hostname }}”
groups: unreachable
when: _check_ping.unreachable|default(false)
-
name: Setup ESXi Hosts
hosts: all:!unreachable
gather_facts: false
…
Regards
Stefan