From 00068e9fcc298b0b18858360d2b8b08708b4993b Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Fri, 23 Mar 2018 15:43:00 -0400 Subject: [PATCH] Add integration tests for include_role using variable for tasks_file (#37742) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add tests using a variable in tasks_from field Related to #32503 * Do not test using hostvars with import_role hostvars cannot be used with import_role — use include_role instead --- .../include_import/role/test_include_role.yml | 12 ++++++++++++ .../include_import/roles/role1/tasks/canary3.yml | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 test/integration/targets/include_import/roles/role1/tasks/canary3.yml diff --git a/test/integration/targets/include_import/role/test_include_role.yml b/test/integration/targets/include_import/role/test_include_role.yml index 2e20a14ced..c0be84c6ba 100644 --- a/test/integration/targets/include_import/role/test_include_role.yml +++ b/test/integration/targets/include_import/role/test_include_role.yml @@ -111,6 +111,18 @@ vars: where_am_i_defined: "{{ test_var }}" + - name: Use a variable in tasks_from field + include_role: + name: role1 + tasks_from: "{{ tasks_file_name }}.yml" + vars: + tasks_file_name: canary3 + + - name: Assert that tasks file was included + assert: + that: + - role1_canary3 == 'r1c3' + ## FIXME This fails with the following error: ## The module {u'include_role': {u'name': u'role1'}} was not found in configured module paths. # - name: Include an entire task diff --git a/test/integration/targets/include_import/roles/role1/tasks/canary3.yml b/test/integration/targets/include_import/roles/role1/tasks/canary3.yml new file mode 100644 index 0000000000..40014e32d1 --- /dev/null +++ b/test/integration/targets/include_import/roles/role1/tasks/canary3.yml @@ -0,0 +1,2 @@ +- set_fact: + role1_canary3: r1c3