Debian Codegraph @

test/integration/targets/copy/tasks/acls.yml

raw
1 - block:
2 - name: Install the acl package on Ubuntu
3 apt:
4 name: acl
5 when: ansible_distribution in ('Ubuntu')
6 register: setup_acl
7
8 - name: Install the acl package on RedHat
9 dnf:
10 name: acl
11 when: ansible_distribution in ('RedHat')
12 register: setup_acl
13
14 - block:
15 - name: Testing ACLs
16 copy:
17 content: "TEST"
18 mode: 0644
19 dest: "~/test.txt"
20
21 - shell: getfacl ~/test.txt
22 register: acls
23
24 become: yes
25 become_user: "{{ remote_unprivileged_user }}"
26
27 - name: Check that there are no ACLs leftovers
28 assert:
29 that:
30 - "'user:' + remote_unprivileged_user + ':r-x\t#effective:r--' not in acls.stdout_lines"
31
32 - name: Check that permissions match with what was set in the mode param
33 assert:
34 that:
35 - "'user::rw-' in acls.stdout_lines"
36 - "'group::r--' in acls.stdout_lines"
37 - "'other::r--' in acls.stdout_lines"
38
39 always:
40 - name: Remove the acl package on Ubuntu
41 apt:
42 name: acl
43 state: absent
44 when: setup_acl is changed and ansible_distribution in ('Ubuntu')
45
46 - name: Remove the acl package on RedHat
47 dnf:
48 name: acl
49 state: absent
50 when: setup_acl is changed and ansible_distribution in ('RedHat')
51
52 - name: Clean up
53 file:
54 path: "~/test.txt"
55 state: absent
56 become: yes
57 become_user: "{{ remote_unprivileged_user }}"