Ansible creates a directory with full permissions even though umask is set to "022" on the managed node

38 views
Skip to first unread message

Minal Deshmukh

unread,
Jul 24, 2019, 10:58:06 AM7/24/19
to Ansible Project
Hello Ansible experts,

I am struck with this issue.
Could you please help me on this.

If I create a directory using Ansible on the managed node it creates it with full permissions.
umask on the managed node in not honored.

Thank you so much!

Regards,
Minal

Dick Visser

unread,
Jul 24, 2019, 3:31:52 PM7/24/19
to ansible...@googlegroups.com
How do you create the directory?
I.E. what does your playbook look like?


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cf2cb550-8bc1-43df-8175-c6cc4322b391%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Minal Deshmukh

unread,
Jul 25, 2019, 1:16:53 AM7/25/19
to Ansible Project
Using Ansible for node \perry which is managed node:
root@ubuntu:~# ansible perry -a umask

perry.in.rdlabs.hpecorp.net | SUCCESS | rc=0 >>
00

Manually on \perry:
Wheras on the \perry it is as below

/home/super: umask
0022

My concern here is before going to even a playbook, Ansible sets umask wrongly or not able to fetch umask from the managed node correctly.

Regards,
Minal

P.Co...@bham.ac.uk

unread,
Jul 25, 2019, 3:49:40 AM7/25/19
to ansible...@googlegroups.com

Hi Minal

 

Could do with more detail, really, as you don’t say what method you’re using. However the “mode” option with the “file” module would accommodate this. See eg and link below:

 

- name: Create a directory if it does not exist

  file:

    path: /etc/some_directory

    state: directory

    mode: '0755'

 

 

https://docs.ansible.com/ansible/latest/modules/file_module.html#file-module

 

 

Regards

Phil

--

Minal Deshmukh

unread,
Jul 25, 2019, 5:59:18 AM7/25/19
to Ansible Project
Hi Phil,

Thank you for your response.

I wrote my custom ansible modules and in that we create a directory using a python os module.

Snippet:
 os.mkdir(path)


Regards,
Minal



On Wednesday, July 24, 2019 at 8:28:06 PM UTC+5:30, Minal Deshmukh wrote:
Reply all
Reply to author
Forward
0 new messages