summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/become_unprivileged/common_remote_group/setup.yml
blob: 1e799c47a4728a51fb4607cf6e36829fa6d51ddf (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
39
40
41
42
43
- name: Prep (as root)
  hosts: ssh
  gather_facts: yes
  remote_user: root
  tasks:
    - name: Create group for unprivileged users
      group:
        name: commongroup

    - name: Add them to the group
      user:
        name: "{{ item }}"
        groups: commongroup
        append: yes
      with_items:
        - unpriv1
        - unpriv2

    - name: Check if /usr/bin/setfacl exists
      stat:
        path: /usr/bin/setfacl
      register: usr_bin_setfacl

    - name: Check if /bin/setfacl exists
      stat:
        path: /bin/setfacl
      register: bin_setfacl

    - name: Set path to setfacl
      set_fact:
        setfacl_path: /usr/bin/setfacl
      when: usr_bin_setfacl.stat.exists

    - name: Set path to setfacl
      set_fact:
        setfacl_path: /bin/setfacl
      when: bin_setfacl.stat.exists

    - name: chmod -x setfacl to disable it
      file:
        path: "{{ setfacl_path }}"
        mode: a-x
      when: setfacl_path is defined