Remove a host from a play after meta: end_host (#66851)
* Remove a host from a play after meta: end_host * Fix changelog
This commit is contained in:
parent
da1bed8932
commit
a2c620819f
2 changed files with 3 additions and 0 deletions
2
changelogs/fragments/end_host-remove_host_from_play.yml
Normal file
2
changelogs/fragments/end_host-remove_host_from_play.yml
Normal file
|
@ -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."
|
|
@ -1094,6 +1094,7 @@ class StrategyBase:
|
||||||
elif meta_action == 'end_host':
|
elif meta_action == 'end_host':
|
||||||
if _evaluate_conditional(target_host):
|
if _evaluate_conditional(target_host):
|
||||||
iterator._host_states[target_host.name].run_state = iterator.ITERATING_COMPLETE
|
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
|
msg = "ending play for %s" % target_host.name
|
||||||
else:
|
else:
|
||||||
skipped = True
|
skipped = True
|
||||||
|
|
Loading…
Reference in a new issue