Ansible Tower: Workflow Job Templates

    The phrase "task flow" speaks for itself. This Ansible Tower feature appeared in version 3.1 and allows you to specify a sequence of operations as a combination of job templates (job templates, as well as synchronization (syncs) of projects and inventory, and then execute this sequence as a whole. In other words, the job flow to help regulate pleybuki (playbooks) and job templates for individual groups.



    Consider what templates of task flows are, what their benefits are, how to create and edit them, as well as a number of other useful points about their use.

    How useful task flows


    They help to formalize and streamline the interaction of teams, for example, networkers and developers, giving them access to the relevant task streams. At the same time, participants do not even need to know the composition and order of the tasks of the flow, since all this is already set up by those who created it. By linking tasks of various types and unifying projects, task flows relieve representatives of one team from the need to understand exactly what the other team is doing, and vice versa.

    In addition, task flows let you link absolutely any number of playbooks to an algorithmic chain of any complexity, where the choice of the next one to complete the task depends on the success or failure of the previous one.

    How to create them


    Click Templates on the Ansible Tower main menu:



    Then click Add , and select Workflow Template :



    A screen will appear where you can specify a name and save the task flow template:



    After you finish, go to Edit Workflow :



    A screen will appear where you can add task templates and set conditions for their launching (if an error occurs or if successful, or unconditionally):



    Launch conditions are specified at the bottom of the panel on the right:



    Ansible task flows can be as simple as possible ...



    ... and very difficult:



    After you configure and save the task flow template, you can run it. To do this, simply click the icon with the rocket to the right of the template name:



    What else can you do with task flows?


    They can be run on a schedule . To do this, click the calendar icon next to the name of the task flow template:



    ... and set its startup parameters:



    To copy the task flow template, click the icon marked with an arrow on the screenshot below:



    However, keep in mind that when you copy a workflow, its permissions, notifications, and schedules are not copied.

    If you need to set additional variables for playbooks involved in the task flow template, and / or organize the input of information from the user, this can be done using surveys . To create a Survey, select a task flow template and click Add Survey :



    A survey screen will appear, where you can ask questions and specify the types of answers:



    Notifications allow you to track the execution of task flows. Simply select the task flow for which you want to configure notifications, and click Notifications :



    Please note that there are already some entries in the list of notifications. Therefore, on the pop-up screen, you need to choose what you need, for example, on the screen, we selected the notification Workflow-Specific Notification, for which activation was set for both successful and unsuccessful startup:



    Note: If you are using dynamic inventory when creating a new task flow template, make sure that the update on launch option is enabled for this inventory.

    Conclusion


    So, we learned how to create a decision tree, combining the existing playbooks, setting up the launch of their tasks and creating notifications. It is especially nice that all these features are available not only in the corporate version of Ansible Tower, so you can play with task streams right now.

    You can learn more about how to create and modify task flow templates in the official Ansible documentation , on a special webinar, and in the comments to this post.

    Also popular now: