# When creating a new directory permissions are always 644

**URL:** <https://forum.ansible.com/t/when-creating-a-new-directory-permissions-are-always-644/35663>\
**Category:** Ansible Project\
**Created:** [August 23, 2021, 10:29pm UTC](https://forum.ansible.com/t/when-creating-a-new-directory-permissions-are-always-644/35663 "2021-08-23T22:29:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CaptainBrewing](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@CaptainBrewing](https://forum.ansible.com/u/CaptainBrewing)\
**Post date:** [August 23, 2021, 10:29pm UTC](https://forum.ansible.com/t/when-creating-a-new-directory-permissions-are-always-644/35663/1 "2021-08-23T22:29:15Z")

</div>

I have the following play to create a new directory

- name: Create DataDog Conf.d directory for Proprietary Apps  
file:  
path: “/etc/datadog-agent/conf.d/{{ applicaton\_name }}.d”  
state: directory  
mode: **0755**  
owner: “dd-agent”  
group: “dd-agent”

No matter what I put in there for the mode the directory comes back “644” as you can see above I have 0755

TASK [fix\_template\_list : Create DataDog Conf.d directory for Proprietary Apps] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [127.0.0.1] =\> {“changed”: false, “gid”: 994, “group”: “dd-agent”, “mode”: “ **0644** ”, “owner”: “dd-agent”, “path”: "/ **etc/datadog-agent/conf.d/application\_name.d"** , “secontext”: “unconfined\_u:object\_r:etc\_t:s0”, “size”: 23, “state”: “directory”, “uid”: 997}

I am using “Become” or Sudo

Ansible has permissions to run this as it actually puts it BACK to 644 if I just use bash to give the directory 755. Ansible puts it back to 644

I am using Ansible 2.9.24 and I am running this locally

---

<div class="post-metadata">

**Author:** ![CaptainBrewing](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@CaptainBrewing](https://forum.ansible.com/u/CaptainBrewing)\
**Post date:** [August 23, 2021, 11:45pm UTC](https://forum.ansible.com/t/when-creating-a-new-directory-permissions-are-always-644/35663/2 "2021-08-23T23:45:13Z")

</div>

Please ignore. User Error, I was in the wrong directory
