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