# Temporarily setting umask

**URL:** <https://forum.ansible.com/t/temporarily-setting-umask/16168>\
**Category:** Ansible Project\
**Created:** [September 9, 2014, 10:09pm UTC](https://forum.ansible.com/t/temporarily-setting-umask/16168 "2014-09-09T22:09:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Ringo](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@Steven\_Ringo](https://forum.ansible.com/u/Steven_Ringo)\
**Post date:** [September 9, 2014, 10:09pm UTC](https://forum.ansible.com/t/temporarily-setting-umask/16168/1 "2014-09-09T22:09:31Z")

</div>

Hi,

We are running a system where the default umask is 0077.

When installing a system-wide rubygem (as root), for example, the installed files and executables are installed with rights for the root user only.

I would like to avoid trying to manually find and set the mode on all the files installed, as there are many (200+) and in quite a few locations.

I could manually change the .profile’s umask to 0022 and then manually revert when done, but this seems like a hack.

Is there any way to run the umask command before an ansible module?

Many thanks,

Steve

---

<div class="post-metadata">

**Author:** ![Johnathan\_Gilday](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Johnathan\_Gilday](https://forum.ansible.com/u/Johnathan_Gilday)\
**Post date:** [December 17, 2015, 2:23pm UTC](https://forum.ansible.com/t/temporarily-setting-umask/16168/2 "2015-12-17T14:23:16Z")

</div>

Steven, I also have this requirement. Were you able to come up with a solution?
