# ansible OSError: \[Errno 17\] File exists: ...

**URL:** <https://forum.ansible.com/t/ansible-oserror-errno-17-file-exists/18776>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [July 15, 2015, 7:05pm UTC](https://forum.ansible.com/t/ansible-oserror-errno-17-file-exists/18776 "2015-07-15T19:05:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![knacktus](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@knacktus](https://forum.ansible.com/u/knacktus)\
**Post date:** [July 15, 2015, 7:05pm UTC](https://forum.ansible.com/t/ansible-oserror-errno-17-file-exists/18776/1 "2015-07-15T19:05:36Z")

</div>

Hi guys,

I’m trying to build a directory structure on a mounted nfs share.

`

# delete existing redis\_host\_base\_dir

- file: path=/mounted\_nfs\_share/redis/run{{ inventory\_hostname }} state=absent

# create redis\_host\_base\_dir

- file: `path=/mounted_nfs_share/redis/run{{ inventory_hostname }}` state=directory

`

These task are performed by several hosts, of course.

I’m getting the following error from the second run (the second host, I just renamed it here host2):

`  
BECOME-SUCCESS-lyoxtbysjakpxkzrxiupq  
Traceback (most recent call last):  
File “/tmp/ansible-tmp-1436984756.54-63840630166614/file”, line 2005, in   
main()  
File “/tmp/ansible-tmp-1436984756.54-63840630166614/file”, line 279, in main  
os.mkdir(curpath)  
OSError: [Errno 17] File exists: ‘`/mounted_nfs_share`/redis/run’  
debug1: mux\_client\_request\_session: master session id: 2  
debug3: mux\_client\_read\_packet: read header failed: Broken pipe  
debug2: Received exit status from master 1  
Shared connection to host2 closed.

`

Now, I’ve found some infos on the internet, but I’m not sure what’s the real problem. Seems to be related to a race condition.

I’m on Python 2.6.6 (quite restricted RHEL 6, so building a local Python didn’t work out so far). Is this issue solved with later versions or unrelated to the Python version?

Might the network storage be the culprit?

Any thoughts or clues how to work around are highly appreciated.

Cheers,

Jan
