Workflow templates

Playbook runs, especially from AWX, can be complex. For example, it might be desirable to update a project from SCM and any dynamic inventories first. We might then run a job template to roll out some updated code. If it fails, however, it would almost certainly be desirable to roll back any changes (or take other remedial action). When you click on our now familiar green + for adding a new template, you will see two options in the drop-down menu—job template (which we have already worked with), and workflow template.

Once all the required fields are filled in for the new workflow template and it is saved, you will be able to click on the WORKFLOW VISUALIZER tab button. This effectively builds up a simple flow, from left to right, of tasks for AWX to perform. For example, the following screenshot shows a workflow where, initially, our demo project is synchronized with its SCM.

If that step succeeds (denoted by the green link to the next block), the demo job template is run. If that in turn succeeds, then the mastery template is run. If any of the preceding steps fail, then the workflow stops there, though an On Failure action can be defined at any stage. Workflows, again, are an advanced discussion beyond the scope of this book, but their presence is worthy of note and further investigation. An example is shown in the following screenshot:

In this way, we can powerfully build up multi-step workflows, taking intelligent action after each stage, depending on whether it succeeded or not.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.51.117