Mark playbook execution as complete when certain file is present in remote system

Hi

We are planning to run our infrastructure on Ansible Pull Mode so all the host machines will keep on polling every few minutes.

In a single outside.yml file, we will have around 8 playbooks.

I want to mark a specific whole playbook as completed if there is certain file present in a remote system.

What is the most ideal way to achieve this ?

It's not possible to mark the execution as complete, but you could skip a role.

Put the playbook in its own file, lets say play1.yml

In outside.yml use stat module to check if the file exist and register the result in a variable e.g. result and then you can include the role like this

- include: play.yml
   when: result.stat.exists == false