Remove a host from a play after meta: end_host (#66851) (#67480)

* Remove a host from a play after meta: end_host

* Fix changelog

(cherry picked from commit a2c620819f)
pull/67986/head
Martin Krizek 5 years ago committed by GitHub
parent ee9c5df0f0
commit 587f241dbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "Fix a bug when a host was not removed from a play after ``meta: end_host`` and as a result the host was still present in ``ansible_play_hosts`` and ``ansible_play_batch`` variables."

@ -1088,6 +1088,7 @@ class StrategyBase:
elif meta_action == 'end_host':
if _evaluate_conditional(target_host):
iterator._host_states[target_host.name].run_state = iterator.ITERATING_COMPLETE
iterator._play._removed_hosts.append(target_host.name)
msg = "ending play for %s" % target_host.name
else:
skipped = True

Loading…
Cancel
Save