# Issue with folder permissions with a playbook

**URL:** <https://forum.ansible.com/t/issue-with-folder-permissions-with-a-playbook/35412>\
**Category:** Ansible Project\
**Created:** [June 25, 2021, 3:30pm UTC](https://forum.ansible.com/t/issue-with-folder-permissions-with-a-playbook/35412 "2021-06-25T15:30:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [June 25, 2021, 3:30pm UTC](https://forum.ansible.com/t/issue-with-folder-permissions-with-a-playbook/35412/1 "2021-06-25T15:30:57Z")

</div>

We have a bash script that creates some folders and puts some ACLs on them, and we’re trying to do this with an Ansible playbook. When we run the bash script, the group permission is rwx like we want, but when running the playbook, it is only rx. Any ideas as to why?

Bash script:

function SecondLevelDirectory {  
echo “Setting up $SITEDIRECTORY/$1…”  
if [! -d “$SITEDIRECTORY/$1”]; then  
mkdir -p $SITEDIRECTORY/$1  
fi

# Clear out any current ACLs

setfacl -b $SITEDIRECTORY/$1

chmod 750 $SITEDIRECTORY/$1  
chmod g+s $SITEDIRECTORY/$1  
chown user1.$SITEGROUPID $SITEDIRECTORY/$1

}  
SecondLevelDirectory Adaptation  
chmod 770 $SITEDIRECTORY/Adaptation  
chgrp $OSFGROUP $SITEDIRECTORY/Adaptation  
setfacl -m g:$SUPPORTINGGROUP:rwx $SITEDIRECTORY/Adaptation

setfacl -m d:g:$SUPPORTINGGROUP:rwx $SITEDIRECTORY/Adaptation

Same thing via Ansible:

- name: Create {{ item.site }} Adaptation Directory  
file:  
path: “/tmp/{{ sitedir }}/{{ item.site }}/Adaptation”  
state: directory  
mode: ‘02750’  
owner: user1  
group: “{{ item.osf }}”

- name: Adjust ownership of {{ item.site }} Adaptation Directory

file:  
path: “/tmp/{{ sitedir }}/{{ item.site }}/Adaptation”  
state: directory  
mode: ‘022770’  
owner: user1  
group: “{{ item.osf }}”

- name: Clear out current ACLs on {{ item.site }} Adaptation Directory

command: “/bin/setfacl -b /tmp/{{ sitedir }}/{{ item.site }}/Adaptation”

- name: Set Supporting OSF ACL on {{ item.site }} Adaptation Directory  
acl:  
path: “/tmp/{{ sitedir }}/{{ item.site }}/Adaptation”  
entity: “{{ item.sosf }}”  
etype: group  
permissions: rwx  
state: present

- name: Set Site Group ACL on {{ item.site }} Adaptation Directory  
acl:  
path: “/tmp/{{ sitedir }}/{{ item.site }}/Adaptation”  
entity: “{{ item.group }}”  
etype: group  
permissions: rx  
state: present

Thanks,  
Harry

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 25, 2021, 4:08pm UTC](https://forum.ansible.com/t/issue-with-folder-permissions-with-a-playbook/35412/2 "2021-06-25T16:08:41Z")

</div>

mode: '022770' \<= seems like a suspect

---

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [June 25, 2021, 6:18pm UTC](https://forum.ansible.com/t/issue-with-folder-permissions-with-a-playbook/35412/3 "2021-06-25T18:18:53Z")

</div>

Didn’t make a difference. When I run the bash script and do a “getfacl” on that directory, the group is rwx:

# file: Adaptation/

# owner: user1

# group: mygroup

# flags: -s-

user::rwx  
group::rwx

With the playbook its rx:

# file: Adaptation/

# owner: user1

# group: mygroup

# flags: -s-

user::rwx  
group::r-x

Harry
