summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/roles_var_inheritance
diff options
context:
space:
mode:
authorSloane Hertel <19572925+s-hertel@users.noreply.github.com>2021-07-06 22:36:28 +0200
committerGitHub <noreply@github.com>2021-07-06 22:36:28 +0200
commitbd03fa811b61528b242d5ef4e0f0f9dc580d2d6f (patch)
treef1bcdff49f5b731ba147e8bccbfa5f01ce11b11b /test/integration/targets/roles_var_inheritance
parentMisc typo fixes (#75188) (diff)
downloadansible-bd03fa811b61528b242d5ef4e0f0f9dc580d2d6f.tar.xz
ansible-bd03fa811b61528b242d5ef4e0f0f9dc580d2d6f.zip
Include parent role vars as well as _role_vars (#75034)
Diffstat (limited to 'test/integration/targets/roles_var_inheritance')
-rw-r--r--test/integration/targets/roles_var_inheritance/aliases1
-rw-r--r--test/integration/targets/roles_var_inheritance/play.yml4
-rw-r--r--test/integration/targets/roles_var_inheritance/roles/A/meta/main.yml4
-rw-r--r--test/integration/targets/roles_var_inheritance/roles/B/meta/main.yml4
-rw-r--r--test/integration/targets/roles_var_inheritance/roles/child_nested_dep/vars/main.yml1
-rw-r--r--test/integration/targets/roles_var_inheritance/roles/common_dep/meta/main.yml4
-rw-r--r--test/integration/targets/roles_var_inheritance/roles/common_dep/vars/main.yml1
-rw-r--r--test/integration/targets/roles_var_inheritance/roles/nested_dep/meta/main.yml3
-rw-r--r--test/integration/targets/roles_var_inheritance/roles/nested_dep/tasks/main.yml5
-rwxr-xr-xtest/integration/targets/roles_var_inheritance/runme.sh9
10 files changed, 36 insertions, 0 deletions
diff --git a/test/integration/targets/roles_var_inheritance/aliases b/test/integration/targets/roles_var_inheritance/aliases
new file mode 100644
index 0000000000..70a7b7a9f3
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/aliases
@@ -0,0 +1 @@
+shippable/posix/group5
diff --git a/test/integration/targets/roles_var_inheritance/play.yml b/test/integration/targets/roles_var_inheritance/play.yml
new file mode 100644
index 0000000000..170eef5771
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/play.yml
@@ -0,0 +1,4 @@
+- hosts: localhost
+ roles:
+ - A
+ - B
diff --git a/test/integration/targets/roles_var_inheritance/roles/A/meta/main.yml b/test/integration/targets/roles_var_inheritance/roles/A/meta/main.yml
new file mode 100644
index 0000000000..0e99e981e2
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/roles/A/meta/main.yml
@@ -0,0 +1,4 @@
+dependencies:
+ - role: common_dep
+ vars:
+ test_var: A
diff --git a/test/integration/targets/roles_var_inheritance/roles/B/meta/main.yml b/test/integration/targets/roles_var_inheritance/roles/B/meta/main.yml
new file mode 100644
index 0000000000..4da174030a
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/roles/B/meta/main.yml
@@ -0,0 +1,4 @@
+dependencies:
+ - role: common_dep
+ vars:
+ test_var: B
diff --git a/test/integration/targets/roles_var_inheritance/roles/child_nested_dep/vars/main.yml b/test/integration/targets/roles_var_inheritance/roles/child_nested_dep/vars/main.yml
new file mode 100644
index 0000000000..6723fa0789
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/roles/child_nested_dep/vars/main.yml
@@ -0,0 +1 @@
+var_precedence: dependency
diff --git a/test/integration/targets/roles_var_inheritance/roles/common_dep/meta/main.yml b/test/integration/targets/roles_var_inheritance/roles/common_dep/meta/main.yml
new file mode 100644
index 0000000000..1ede7be8ee
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/roles/common_dep/meta/main.yml
@@ -0,0 +1,4 @@
+dependencies:
+ - role: nested_dep
+ vars:
+ nested_var: "{{ test_var }}"
diff --git a/test/integration/targets/roles_var_inheritance/roles/common_dep/vars/main.yml b/test/integration/targets/roles_var_inheritance/roles/common_dep/vars/main.yml
new file mode 100644
index 0000000000..87b6b58061
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/roles/common_dep/vars/main.yml
@@ -0,0 +1 @@
+var_precedence: parent
diff --git a/test/integration/targets/roles_var_inheritance/roles/nested_dep/meta/main.yml b/test/integration/targets/roles_var_inheritance/roles/nested_dep/meta/main.yml
new file mode 100644
index 0000000000..231c6c14d7
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/roles/nested_dep/meta/main.yml
@@ -0,0 +1,3 @@
+allow_duplicates: yes
+dependencies:
+ - child_nested_dep
diff --git a/test/integration/targets/roles_var_inheritance/roles/nested_dep/tasks/main.yml b/test/integration/targets/roles_var_inheritance/roles/nested_dep/tasks/main.yml
new file mode 100644
index 0000000000..c69070ca90
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/roles/nested_dep/tasks/main.yml
@@ -0,0 +1,5 @@
+- debug:
+ var: nested_var
+
+- debug:
+ var: var_precedence
diff --git a/test/integration/targets/roles_var_inheritance/runme.sh b/test/integration/targets/roles_var_inheritance/runme.sh
new file mode 100755
index 0000000000..791155a852
--- /dev/null
+++ b/test/integration/targets/roles_var_inheritance/runme.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+set -eux
+
+ansible-playbook -i ../../inventory play.yml "$@" | tee out.txt
+
+test "$(grep out.txt -ce '"nested_var": "A"')" == 1
+test "$(grep out.txt -ce '"nested_var": "B"')" == 1
+test "$(grep out.txt -ce '"var_precedence": "dependency"')" == 2