diff options
author | Costi Ciudatu <ciudatu@adobe.com> | 2014-12-11 18:47:24 +0200 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2015-02-17 13:39:59 -0600 |
commit | b1f611fedb4280073a15a7b935ade17daf4651c8 (patch) | |
tree | c9508ad8c549920c842b095d70576d95fb56177b | |
parent | a16d0a8dd6db6be90b01fae0e17bc00d6d3aca60 (diff) | |
download | ansible-b1f611fedb4280073a15a7b935ade17daf4651c8.tar.gz |
run_once tasks are skipped without checking the delegate_to host #9784
-rw-r--r-- | lib/ansible/runner/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 15beab83b1..99c7797b11 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -1461,9 +1461,15 @@ class Runner(object): # Expose the current hostgroup to the bypassing plugins self.host_set = hosts # We aren't iterating over all the hosts in this - # group. So, just pick the first host in our group to + # group. So, just choose the "delegate_to" host if that is defined and is + # one of the targeted hosts, otherwise pick the first host in our group to # construct the conn object with. - result_data = self._executor(hosts[0], None).result + if self.delegate_to is not None and self.delegate_to in hosts: + host = self.delegate_to + else: + host = hosts[0] + + result_data = self._executor(host, None).result # Create a ResultData item for each host in this group # using the returned result. If we didn't do this we would # get false reports of dark hosts. |