Debian Codegraph @

lib/ansible/plugins/test/contains.yml

raw
1 DOCUMENTATION:
2 name: contains
3 author: Ansible Core
4 version_added: "2.4"
5 short_description: does the list contain this element
6 description:
7 - Checks the supplied element against the input list to see if it exists within it.
8 options:
9 _input:
10 description: List of elements to compare.
11 type: list
12 elements: raw
13 required: True
14 _contained:
15 description: Element to test for.
16 type: raw
17 required: True
18 EXAMPLES: |
19 # simple expression
20 {{ listofthings is contains('this') }}
21
22 # as a selector
23 - action: module=doessomething
24 when: (lacp_groups|selectattr('interfaces', 'contains', 'em1')|first).master
25 vars:
26 lacp_groups:
27 - master: lacp0
28 network: 10.65.100.0/24
29 gateway: 10.65.100.1
30 dns4:
31 - 10.65.100.10
32 - 10.65.100.11
33 interfaces:
34 - em1
35 - em2
36
37 - master: lacp1
38 network: 10.65.120.0/24
39 gateway: 10.65.120.1
40 dns4:
41 - 10.65.100.10
42 - 10.65.100.11
43 interfaces:
44 - em3
45 - em4
46 RETURN:
47 _value:
48 description: Returns V(True) if the specified element is contained in the supplied sequence, V(False) otherwise.
49 type: boolean