summaryrefslogtreecommitdiffstats
path: root/test/using-bare-variables-failure.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:04:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:04:50 +0000
commit782f8df6e41f29dce2db4970a3ad84aaeb7d8c5f (patch)
tree3a88a542cd8074743d251881131510157cfc510b /test/using-bare-variables-failure.yml
parentInitial commit. (diff)
downloadansible-lint-782f8df6e41f29dce2db4970a3ad84aaeb7d8c5f.tar.xz
ansible-lint-782f8df6e41f29dce2db4970a3ad84aaeb7d8c5f.zip
Adding upstream version 4.3.7.upstream/4.3.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/using-bare-variables-failure.yml')
-rw-r--r--test/using-bare-variables-failure.yml108
1 files changed, 108 insertions, 0 deletions
diff --git a/test/using-bare-variables-failure.yml b/test/using-bare-variables-failure.yml
new file mode 100644
index 0000000..865381b
--- /dev/null
+++ b/test/using-bare-variables-failure.yml
@@ -0,0 +1,108 @@
+---
+- hosts: localhost
+ become: no
+ vars:
+ my_list:
+ - foo
+ - bar
+
+ my_list2:
+ - 1
+ - 2
+
+ my_list_of_dicts:
+ - foo: 1
+ bar: 2
+ - foo: 3
+ bar: 4
+
+ my_list_of_lists:
+ - "{{ my_list }}"
+ - "{{ my_list2 }}"
+
+ my_filenames:
+ - foo.txt
+ - bar.txt
+
+ my_dict:
+ foo: bar
+
+ tasks:
+ - name: with_items loop using bare variable
+ debug:
+ msg: "{{ item }}"
+ with_items: my_list
+
+ - name: with_dict loop using bare variable
+ debug:
+ msg: "{{ item }}"
+ with_dict: my_dict
+
+ ### Testing with_dict with a default empty dictionary
+ - name: with_dict loop using variable and default
+ debug:
+ msg: "{{ item.key }} - {{ item.value }}"
+ with_dict: uwsgi_ini | default({})
+
+ - name: with_nested loop using bare variable
+ debug:
+ msg: "{{ item.0 }} {{ item.1 }}"
+ with_nested:
+ - my_list
+ - "{{ my_list2 }}"
+
+ - name: with_file loop using bare variable
+ debug:
+ msg: "{{ item }}"
+ with_file: my_list
+
+ - name: with_fileglob loop using bare variable
+ debug:
+ msg: "{{ item }}"
+ with_fileglob: my_list
+
+ - name: with_filetree loop using bare variable
+ debug:
+ msg: "{{ item }}"
+ with_filetree: my_list
+
+ - name: with_together loop using bare variable
+ debug:
+ msg: "{{ item.0 }} {{ item.1 }}"
+ with_together:
+ - my_list
+ - "{{ my_list2 }}"
+
+ - name: with_subelements loop using bare variable
+ debug:
+ msg: "{{ item.0 }}"
+ with_subelements:
+ - my_list_of_dicts
+ - bar
+
+ - name: with_random_choice loop using bare variable
+ debug:
+ msg: "{{ item }}"
+ with_random_choice: my_list
+
+ - name: with_first_found loop using bare variable
+ debug:
+ msg: "{{ item }}"
+ with_first_found: my_filenames
+
+ - name: with_indexed_items loop
+ debug:
+ msg: "{{ item.0 }} {{ item.1 }}"
+ with_indexed_items: my_list
+
+ - name: with_flattened loop
+ debug:
+ msg: "{{ item }}"
+ with_flattened:
+ - my_list
+ - my_list2
+
+ - name: with_flattened loop with a variable
+ debug:
+ msg: "{{ item }}"
+ with_flattened: my_list_of_lists