summaryrefslogtreecommitdiffstats
path: root/app-admin/ansible/files/ansible-include-role.patch
blob: 5ef7967043b1748a5c7f86e8ee2f214b0be502b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff -dPNur ansible-2.4.3.0/lib/ansible/playbook/included_file.py ansible-2.4.3.0-new2/lib/ansible/playbook/included_file.py
--- ansible-2.4.3.0/lib/ansible/playbook/included_file.py	2018-02-01 00:09:48.000000000 +0100
+++ ansible-2.4.3.0-new2/lib/ansible/playbook/included_file.py	2018-03-21 13:39:25.259172590 +0100
@@ -134,6 +134,17 @@
                         include_file = templar.template(include_file)
                         inc_file = IncludedFile(include_file, include_variables, original_task)
                     else:
+                        # template the included role's name here
+                        role_name = include_variables.get('name', include_variables.get('role', None))
+                        if role_name is not None:
+                            role_name = templar.template(role_name)
+
+                        original_task._role_name = role_name
+                        for from_arg in original_task.FROM_ARGS:
+                            if from_arg in include_variables:
+                                from_key = from_arg.replace('_from', '')
+                                original_task._from_files[from_key] = templar.template(include_variables[from_arg])
+
                         inc_file = IncludedFile("role", include_variables, original_task, is_role=True)
 
                     try:
diff -dPNur ansible-2.4.3.0/lib/ansible/plugins/strategy/free.py ansible-2.4.3.0-new2/lib/ansible/plugins/strategy/free.py
--- ansible-2.4.3.0/lib/ansible/plugins/strategy/free.py	2018-02-01 00:09:48.000000000 +0100
+++ ansible-2.4.3.0-new2/lib/ansible/plugins/strategy/free.py	2018-03-21 13:39:25.259172590 +0100
@@ -197,7 +197,7 @@
                             new_ir = included_file._task.copy()
                             new_ir.vars.update(included_file._args)
 
-                            new_blocks, handler_blocks = new_ir.get_block_list(
+                            new_blocks, handler_blocks = included_file._task.get_block_list(
                                 play=iterator._play,
                                 variable_manager=self._variable_manager,
                                 loader=self._loader,
diff -dPNur ansible-2.4.3.0/lib/ansible/plugins/strategy/free.py.orig ansible-2.4.3.0-new2/lib/ansible/plugins/strategy/free.py.orig