Debian Codegraph @

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

raw
1 ---
2 # Test for issue #86368 - ensure /nonexistent is not created on FreeBSD
3 # when modifying a user to add them to a group
4
5 - name: Create a test user with /nonexistent as home directory
6 user:
7 name: ansibulltestuser
8 home: /nonexistent
9 create_home: no
10 state: present
11 register: user_create
12
13 - name: Create a test group
14 group:
15 name: ansibulltestgroup
16 state: present
17
18 - name: Add user to group (should not create /nonexistent)
19 user:
20 name: ansibulltestuser
21 groups: ansibulltestgroup
22 append: true
23 register: user_modify
24
25 - name: Check if /nonexistent was created (it should not exist)
26 stat:
27 path: /nonexistent
28 register: nonexistent_stat
29
30 - name: Validate that /nonexistent was not created
31 assert:
32 that:
33 - user_create is changed
34 - user_modify is changed
35 - not nonexistent_stat.stat.exists
36 fail_msg: "/nonexistent directory should not be created when adding user to group"
37
38 - name: Clean up - remove test user
39 user:
40 name: ansibulltestuser
41 state: absent
42 force: true
43
44 - name: Clean up - remove test group
45 group:
46 name: ansibulltestgroup
47 state: absent