summaryrefslogtreecommitdiff
path: root/test/integration/targets/include_vars/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/include_vars/tasks/main.yml')
-rw-r--r--test/integration/targets/include_vars/tasks/main.yml52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/integration/targets/include_vars/tasks/main.yml b/test/integration/targets/include_vars/tasks/main.yml
index 6fc4e85a..97636d9d 100644
--- a/test/integration/targets/include_vars/tasks/main.yml
+++ b/test/integration/targets/include_vars/tasks/main.yml
@@ -208,6 +208,21 @@
- "config.key2.b == 22"
- "config.key3 == 3"
+- name: Include a vars dir with hash variables
+ include_vars:
+ dir: "{{ role_path }}/vars2/hashes/"
+ hash_behaviour: merge
+
+- name: Verify that the hash is merged after vars files are accumulated
+ assert:
+ that:
+ - "config | length == 3"
+ - "config.key0 is undefined"
+ - "config.key1 == 1"
+ - "config.key2 | length == 1"
+ - "config.key2.b == 22"
+ - "config.key3 == 3"
+
- include_vars:
file: no_auto_unsafe.yml
register: baz
@@ -215,3 +230,40 @@
- assert:
that:
- baz.ansible_facts.foo|type_debug != "AnsibleUnsafeText"
+
+- name: setup test following symlinks
+ delegate_to: localhost
+ block:
+ - name: create directory to test following symlinks
+ file:
+ path: "{{ role_path }}/test_symlink"
+ state: directory
+
+ - name: create symlink to the vars2 dir
+ file:
+ src: "{{ role_path }}/vars2"
+ dest: "{{ role_path }}/test_symlink/symlink"
+ state: link
+
+- name: include vars by following the symlink
+ include_vars:
+ dir: "{{ role_path }}/test_symlink"
+ register: follow_sym
+
+- assert:
+ that: follow_sym.ansible_included_var_files | sort == [hash1, hash2]
+ vars:
+ hash1: "{{ role_path }}/test_symlink/symlink/hashes/hash1.yml"
+ hash2: "{{ role_path }}/test_symlink/symlink/hashes/hash2.yml"
+
+- name: Test include_vars includes everything to the correct depth
+ ansible.builtin.include_vars:
+ dir: "{{ role_path }}/files/test_depth"
+ depth: 3
+ name: test_depth_var
+ register: test_depth
+
+- assert:
+ that:
+ - "test_depth.ansible_included_var_files|length == 8"
+ - "test_depth_var.keys()|length == 8"