summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/copy/tasks/acls.yml
blob: d7d099e662f1bc8c4dfaf5ee71c64635e5905595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- block:
  - name: Install the acl package on Ubuntu
    apt:
      name: acl
    when: ansible_distribution in ('Ubuntu')

  - block:
    - name: Testing ACLs
      copy:
        content: "TEST"
        mode: 0644
        dest: "~/test.txt"

    - shell: getfacl ~/test.txt
      register: acls

    become: yes
    become_user: "{{ remote_unprivileged_user }}"

  - name: Check that there are no ACLs leftovers
    assert:
      that:
        - "'user:{{ remote_unprivileged_user }}:r-x\t#effective:r--' not in acls.stdout_lines"

  - name: Check that permissions match with what was set in the mode param
    assert:
      that:
        - "'user::rw-' in acls.stdout_lines"
        - "'group::r--' in acls.stdout_lines"
        - "'other::r--' in acls.stdout_lines"

  always:
    - name: Clean up
      file:
        path: "~/test.txt"
        state: absent
      become: yes
      become_user: "{{ remote_unprivileged_user }}"