mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-20 23:30:22 -07:00
Rename var lookup to vars and add tests
This commit is contained in:
parent
db29190c28
commit
03c73e2bbb
2 changed files with 33 additions and 12 deletions
|
@ -286,3 +286,22 @@
|
|||
- assert:
|
||||
that:
|
||||
- "hello_world|trim == 'Hello world!'"
|
||||
|
||||
# Vars lookups
|
||||
|
||||
- name: Test that we can give it a single value and receive a single value
|
||||
set_fact:
|
||||
var_host: '{{ lookup("vars", "ansible_host") }}'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'var_host == ansible_host'
|
||||
|
||||
- name: Test that we can give a list of values to var and receive a list of values back
|
||||
set_fact:
|
||||
var_host_info: '{{ query("vars", "ansible_host", "ansible_user") }}'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'var_host_info[0] == ansible_host'
|
||||
- 'var_host_info[1] == ansible_user'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue