I have a multi-node setup where I am using ansible to perform certain
action. There exist a NFS mounted directory which is shared between the
nodes.
I am having unexpected behaviour when the ansible tries to modify the same
file from different nodes.
For example: Node01, Node02, Node03
File resides in: /home/demouser/test.txt (/home/demouser is nfs mounted and
shared across all the nodes.)
My ansible script is something like this: (Ansible Version 1.8.4)
- hosts: all tasks:
- name: executing shell command
- shell: echo "test" >> /home/demouser/demotmp.txt | uniq >
/home/demouser/demotmp_unique.txt | cp /tmp/demotmp_unique.txt
/home/demouser/test.txt
Occassionally I get a scenario when the updated file is empty. My guess is,
this happens as ansible tries to modify the file on all nodes at roughly
the same time.
Is there a module which allows locking a file? Or is there a better way to
do this?
Thanks
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a816b03a-4510-4328-986e-06a5aa4ba96b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.