Hello,
I see that pre_tasks and post_tasks exist for roles, where you can run individual tasks before or after completing all of the actions in a role. I also see that there is notify, which is for executing a handler if a task caused a change to the target system.
The former covers the case where the entire playbook is applied at once to a target, and the latter covers the case where I can restart services after making changes. However, I need to stop some services before executing a task, no matter how or why the task gets executed. After the task is complete, I need to start the previously stopped services again. How could I do this?
i.e.
…
stop A
stop B
update something
start B
start A
…
where “update something” is an individual task in one of my roles.
Thanks,
Sash