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

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