How can we prevent 2 Ansible playbook to run on the same host at the same time?

?How can we prevent from 2 ansible running on the same host at the same time
we are working with facts_catch json file and sometimes have problem that 2 ansibles try write the same json

fact_caching = jsonfile
fact_caching_connection = /tmp/facts_cache
fact_caching_timeout = 7200

Any file based operations that affect the controller are going to be dangerous if multiple processes are trying to do them. If you know this is going to be a common pattern, where multiple playbook executions are happening simultaneously, I’d recommend a database backed fact caching mechanism, such a redis.

There is no fool proof way of ensuring that multiple ansible invocations cannot be run simultaneously.