How to remember state?

Hi all,

Let's say we have a role-a with two tasks: task-1 and task-2. Task-2
only runs if task-1 has triggered a change. So far, so good. But what
happens when task-2 fails? If we rerun role-a then task-1 will not
trigger a change so task-2 will not run. But we still need it to run.

Is there a way to "remember" the fact that task-2 should run? The best
I can come up with is to create a task-2-must-run empty marker file
somewhere when task-1 triggers a change [and assume that creating said
file will never fail :slight_smile: ]. Then have task-2 trigger on the existence
of the marker file.

That seems possible but rather convoluted. Thoughts?

Cheers,
Hilco

Hi Hilco, you can use the --start-at-task option to start execution of a playbook at a given task. The --step option can also be used, which asks if you wish to skip each task in the playbook (you can give it an answer to stop prompting and just run as well).

I am just now noticing that there doesn’t appear to be any documentation regarding these options on our docs site, so I’ll create a github issue for that as well.

Finally, when a task fails, a “retry” file is created, which you can use to re-execute on hosts which have failed.

Thanks!