[stable-2.10] Don't treat host_pinned as lockstep (#73484) (#73504)

* [stable-2.10] Don't treat host_pinned as lockstep (#73484)

* Don't treat host_pinned as lockstep. Fixes #73364

* Add intg tests.
(cherry picked from commit d3f3784b86)

Co-authored-by: Matt Martz <matt@sivel.net>

* Make non-lockstep callback tests more deterministic (#73511)

(cherry picked from commit 125c220343)
pull/73776/head
Matt Martz 5 years ago committed by GitHub
parent 0a6004d9ca
commit d720a5e42c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
bugfixes:
- default callback - Ensure that the ``host_pinned`` strategy is not treated as lockstep
(https://github.com/ansible/ansible/issues/73364)

@ -186,8 +186,8 @@ class CallbackModule(CallbackBase):
# Preserve task name, as all vars may not be available for templating
# when we need it later
if self._play.strategy == 'free':
# Explicitly set to None for strategy 'free' to account for any cached
if self._play.strategy in ('free', 'host_pinned'):
# Explicitly set to None for strategy free/host_pinned to account for any cached
# task title from a previous non-free play
self._last_task_name = None
else:

@ -0,0 +1,35 @@
PLAY [nonlockstep] *************************************************************
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost12]
TASK [command] *****************************************************************
changed: [testhost12]
TASK [command] *****************************************************************
changed: [testhost12]
PLAY RECAP *********************************************************************
testhost10 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
testhost11 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
testhost12 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

@ -0,0 +1,35 @@
PLAY [nonlockstep] *************************************************************
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost12]
TASK [command] *****************************************************************
changed: [testhost12]
TASK [command] *****************************************************************
changed: [testhost12]
PLAY RECAP *********************************************************************
testhost10 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
testhost11 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
testhost12 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

@ -3,3 +3,8 @@ testhost ansible_connection=local ansible_python_interpreter="{{ ansible_playboo
[nonexistent]
testhost5 ansible_host=169.254.199.200 # no connection is ever established with this host
[nonlockstep]
testhost10 i=0.5 ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
testhost11 i=3.0 ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
testhost12 i=12.0 ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"

@ -184,3 +184,7 @@ run_test_dryrun check_nomarkers_wet
# Test the dry run without check markers
run_test_dryrun check_nomarkers_dry --check
# Ensure free/host_pinned non-lockstep strategies display correctly
diff -u callback_default.out.free.stdout <(ANSIBLE_STRATEGY=free ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null)
diff -u callback_default.out.host_pinned.stdout <(ANSIBLE_STRATEGY=host_pinned ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null)

@ -0,0 +1,7 @@
---
- hosts: nonlockstep
gather_facts: false
tasks:
- command: sleep {{ i }}
- command: sleep {{ i }}
- command: sleep {{ i }}
Loading…
Cancel
Save