diff options
author | Xaroth <xaroth+github@xaroth.nl> | 2019-04-23 17:55:05 +0200 |
---|---|---|
committer | Sam Doran <sdoran@redhat.com> | 2019-04-23 11:55:05 -0400 |
commit | a9f24e097fd238e31be404f2046a954be88a4262 (patch) | |
tree | 0a58492444dbe28d0bc03a2e591dc8ba1c32dfcb /test/integration/targets/special_vars | |
parent | b442706b543d5e890940d14f9701ebdaae27d83e (diff) | |
download | ansible-a9f24e097fd238e31be404f2046a954be88a4262.tar.gz |
Add ansible_parent_role_names magic variable (#46687)
-Add: Test cases for ansible_parent_role_names and ansible_parent_role_paths
-Add: ansible_parent_role_names/paths variables for when a role is being included by another role.
Diffstat (limited to 'test/integration/targets/special_vars')
-rw-r--r-- | test/integration/targets/special_vars/aliases | 1 | ||||
-rw-r--r-- | test/integration/targets/special_vars/tasks/main.yml | 42 |
2 files changed, 43 insertions, 0 deletions
diff --git a/test/integration/targets/special_vars/aliases b/test/integration/targets/special_vars/aliases index 765b70da79..2d9e6788ad 100644 --- a/test/integration/targets/special_vars/aliases +++ b/test/integration/targets/special_vars/aliases @@ -1 +1,2 @@ shippable/posix/group2 +needs/target/include_parent_role_vars diff --git a/test/integration/targets/special_vars/tasks/main.yml b/test/integration/targets/special_vars/tasks/main.yml index ab5c318d73..1950f4cbea 100644 --- a/test/integration/targets/special_vars/tasks/main.yml +++ b/test/integration/targets/special_vars/tasks/main.yml @@ -56,3 +56,45 @@ assert: that: - "(ansible_play_role_names + ansible_dependent_role_names)|unique|sort|list == ansible_role_names|sort|list" + +- name: check that ansible_parent_role_names is normally unset when not included/imported (before including other roles) + assert: + that: + - "ansible_parent_role_names is undefined" + - "ansible_parent_role_paths is undefined" + +- name: ansible_parent_role_names - test functionality by including another role + include_role: + name: include_parent_role_vars + tasks_from: included_by_other_role.yml + +- name: check that ansible_parent_role_names is normally unset when not included/imported (after including other role) + assert: + that: + - "ansible_parent_role_names is undefined" + - "ansible_parent_role_paths is undefined" + +- name: ansible_parent_role_names - test functionality by importing another role + import_role: + name: include_parent_role_vars + tasks_from: included_by_other_role.yml + +- name: check that ansible_parent_role_names is normally unset when not included/imported (after importing other role) + assert: + that: + - "ansible_parent_role_names is undefined" + - "ansible_parent_role_paths is undefined" + +- name: ansible_parent_role_names - test functionality by including another role + include_role: + name: include_parent_role_vars + +- name: check that ansible_parent_role_names is normally unset when not included/imported (after both import and inlcude) + assert: + that: + - "ansible_parent_role_names is undefined" + - "ansible_parent_role_paths is undefined" + +- name: ansible_parent_role_names - test functionality by importing another role + import_role: + name: include_parent_role_vars |