Debian Codegraph @

test/integration/targets/user/tasks/test_invalid_shell.yml

raw
1 ---
2 - name: Run test for Alpine Linux only
3 meta: end_host
4 when: ansible_distribution != 'Alpine'
5
6 - name: Move user home directory
7 block:
8 - name: Create user with invalid shell
9 user:
10 name: ansibulluser
11 shell: /tmp/ansibulluser
12 state: present
13 register: user_output
14 ignore_errors: true
15
16 - name: Check if user output contains error
17 assert:
18 that:
19 - user_output.warnings is defined
20 - user_output.warnings is search("'/tmp/ansibulluser' is not listed as a valid shell on the remote host")
21
22 always:
23 - name: Remove user
24 user:
25 name: ansibulluser
26 state: absent