Debian Codegraph @

test/integration/targets/getent/tasks/main.yml

raw
1 # Test code for the getent module.
2 # (c) 2017, James Tanner <[email protected]>
3 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
5 - name: check for getent command
6 shell: which getent
7 failed_when: False
8 register: getent_check
9
10 - name: skip test on unsupported platforms
11 meta: end_play
12 when: getent_check.rc != 0
13
14 - name: run getent with specified service
15 getent:
16 database: passwd
17 key: root
18 service: files
19 register: getent_test0
20 when: ansible_system != 'FreeBSD' and ansible_distribution != 'Alpine'
21
22 - name: run getent w/o specified service (FreeBSD)
23 getent:
24 database: passwd
25 key: root
26 register: getent_test0
27 when: ansible_system == 'FreeBSD' or ansible_distribution == 'Alpine'
28
29 - name: validate results
30 assert:
31 that:
32 - 'getent_test0 is success'
33 - 'getent_passwd is defined'
34 - 'getent_passwd.root is defined'
35 - 'getent_passwd.root|length == 6'
36
37 - name: run getent with invalid split value
38 getent:
39 database: group
40 split: ""
41 register: getent_test1
42 ignore_errors: True
43
44 - name: validate results
45 assert:
46 that:
47 - 'getent_test1 is failed'
48 - 'getent_test1.msg is contains "Invalid split value. The value must be a non-empty string"'
49
50 - name: run getent with specified service on Alpine (expected failure)
51 getent:
52 database: passwd
53 service: files
54 register: getent_service_unsupported
55 ignore_errors: true
56 when: ansible_distribution == 'Alpine'
57
58 - name: validate unsupported service result on Alpine (expected failure)
59 assert:
60 that:
61 - 'getent_service_unsupported is failed'
62 - 'getent_service_unsupported.msg is contains "Specifying service `files` not supported on this platform."'
63 when: ansible_distribution == 'Alpine'