ansible with nohup not stable

ansible is running on myMaster,and there is 14 clients(myhost1 to myhost14) to be managed.my command is like below:
ansible myhosti -m shell -a “nohup sh /home/hadoop/calculate.sh >> /home/hadoop/logs/myhosti.log 2>&1 &”

/home/hadoop/calculate.sh
#!/bin/sh
echo “------------------------------”
babababbababa…

the command executes correctly mostly,sometimes i got myhosti.log,but the file myhosti.log is empty. and this happends irregularly.
Who has encountered such a situation?

Is ‘myhosti’ a group of hosts? If so, ansible will spawn a separate thread for each host, so I imagine all threads are going to write to one file, potentially overwriting each other. You could run with -f1 (just use 1 fork) to avoid this problem, or figure out a way for each host to write to its own log file.

Hope this helps,

Jon