summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/lookup_vars/tasks/main.yml
blob: f24d8657adce25354e0e81af7d85186de27bd97b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- 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_connection") }}'

- assert:
    that:
      - 'var_host_info[0] == ansible_host'
      - 'var_host_info[1] == ansible_connection'