From 247e43b25244720f81e41febf0993f4b435fcb3d Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Thu, 4 Jun 2020 09:41:46 -0600 Subject: Fix IncludedFile equality check (#69524) In the case of a free style strategy, it is possible to end up with multiple hosts trying to include from the same role, however the tasks being included may be different with the use of tasks_from. Previously if you had two hosts that were included the same role when the process_include_results function tries to determine if a included needs to be run on a specific host, it would end up merging two different tasks into which ever one was processed first. This change updates the equality check to also check if the task uuid associated with the IncludedFile is the same. The previous check only checked if the task's parent uuid was the same. This breaks down when both includes have the same parent. - hosts: all strategy: free gather_facts: false tasks: - include_role: name: random_sleep - block: - name: set a fact (1) include_role: name: set_a_fact tasks_from: fact1.yml - name: set a fact (2) include_role: name: set_a_fact tasks_from: fact2.yml - name: include didn't run fail: msg: > set_a_fact didn't run fact1: {{ fact1 | default('not defined')}} fact2: {{ fact2 | default('not defined') }}" when: (fact1 is not defined or fact2 is not defined) Closes #69521 --- lib/ansible/playbook/included_file.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/ansible/playbook/included_file.py b/lib/ansible/playbook/included_file.py index 7870d83a6a..1466367336 100644 --- a/lib/ansible/playbook/included_file.py +++ b/lib/ansible/playbook/included_file.py @@ -51,6 +51,7 @@ class IncludedFile: return (other._filename == self._filename and other._args == self._args and other._vars == self._vars and + other._task._uuid == self._task._uuid and other._task._parent._uuid == self._task._parent._uuid) def __repr__(self): -- cgit v1.2.3