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

17 views
Skip to first unread message

Zeal Vora

unread,
Jul 10, 2016, 3:02:02 PM7/10/16
to Ansible Project
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 ? 

Kai Stian Olstad

unread,
Jul 11, 2016, 9:58:13 AM7/11/16
to ansible...@googlegroups.com
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

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages