So in this demo, we're going to examine workflow templates.
We will create a workflow template that consists of actions
that trigger another job template to run.
We will also go through some of the different options available
allowing you to find your automation jobs.
So let us quickly create a new project and we'll call this WorkFlow Project,
and we'll make sure that this project is appointed the correct SCM details,
which is my repository on GitHub,
which holds the playbooks that we're going to use in the job
templates to form the workflow visualizer.
So here, you can see that we are pointing to my GitHub repository,
where I have a number of playbooks.
So for this workflow template, we'll be using to job templates,
and we'll be linking them together in the visualizer.
So we can quickly go to my GitHub repository just to
confirm the playbooks that I'll be using.
Firstly, I'll be using install playbook,
which will be installing the package on the localhost and starting the services.
Notice that we have a variable that could be replaced with a survey.
We also have another basic playbook called alert,
which is a playbook that will be used in the debug module
to print an error message to the screen.
To start all of this, we need to firstly create a workflow template,
and afterwards, we need to link the job templates to this workflow template.
So under the Resource section we select Templates,
and we add a new template, but this time,
instead of creating a standard job template,
we're going to be creating a workflow template.
Within the workflow template details,
we want to call this Workflow Template Alert and fill out some basic details.
We'll give it the name, here we're entering name of the workflow template.
A description if we want to, but it's optional.
The organization.
We can enter research inventory to be used for this workflow template.
We also have options such as limited labels.
Limit is to specify limit for the subset of servers
that your workflow is going to run on.
Labels may be useful, and they're also optional.
That describe this workflow template, such as dev or test.
Labels can be used to group and filter workflow templates
and completed jobs in Tower display.
We also have a number of, let's say,
advanced options where we have check enabled concurrent jobs.
This will allow simultaneous runs of this workflow.
We also have check enabled webhooks.
This will turn on the ability to interface with a
predefined SCM system web service.
That is used to launch a job template.
Then we need to click on Save, and this will save those current details,
and then we can go back into the workflow template
and add any additional information.
We have the options of permissions, which will allow you to review,
grant, edit, and remove associated permissions for users,
as well as team members.
We also have notifications that might be quite useful that will allow you
to review any notification integrations you may have.
Completed jobs tab provides a list of workflow templates that you have run,
and schedules, as you know,
might be useful for running this without human intervention.
I'm actually not going to set any of these up here,
but I will actually set up a survey.
So here,
we'll be prompting the user in a user‑friendly way to guide the
playbook run and ask what package they want to install.
Okay, so firstly now, let us create the first job template,
and this is going to be Install a Package.
So we're going to give it a name, project,
select the playbook, we're also going to select some credentials,
but we don't actually want to install anything because
we want to force an error from this.
So I'm purposely going to leave out privileged escalation,
as this will be needed to install a package.
Once this is done, we can move onto the next job template.
So we're going to fill out similar details here,
such as the name, the playbook,
and for the playbook we're going to look for the playbook alert.
We're also going to select the credentials.
So now that we've done the second step,
you know that the first step is creating the workflow template,
and then we go on and we create the two job templates.
So now we want to glue all of this together.
So think of the workflow visualizer as something that can provide a
graphical way of linking together job templates,
even workflow templates, project syncs, and inventory syncs.
So next, we go to the workflow,
and here we're going to click on the visualizer. so you can set up any
combination of two or more of the following node types, that will help
you build out your workflow structure.
We have templates, which is what we're going to use in this demo. These
templates can include job templates or even workflow templates.
We can have project syncs, inventory syncs, or approval.
So in our demo,
we're just going to select job Templates, and then we're going to call the
playbook install. Once this is selected, on the bottom left,
you can see JT, that represents job template, but
we also have three other icons.
We have a green plus, a blue link, and a red X.
So keep in mind that each node is represented by a rectangle, while
the relationships and their associated edge types are represented by
a line or a link that connects them.
For this demo,
I'll click on the plus to add a node, and this is
going to add a new job template.
This opens up a similar screen where we can add a node in our case,
which will be a template. Here,
we're going to choose the playbooks that we want to run.
So now under the Run section, we have three different options, as
this is the second node in our workflow template.
So we have different run options, such as On Success, On
Failure, and Always. So these are the conditions on which the
node should be executed. For this demo,
the job workflow I want to use is On Failure, as the first
job template in this workflow will fail.
So once we're happy with the settings that we have created,
we'll go back to the visualizer and then we'll click on Launch.
So we have a survey with this workflow, so our survey
will appear and we'll be asked to drive the playbook.
Here, I'll just be entering nmap.
So what we enter here doesn't really matter, but I just wanted to
illustrate how we can incorporate surveys into workflow
templates. Next, we click on Launch, and we can see that's going
to go through each of the stages.
It starts in the first job template, this will be a failure due
to privileged escalation, and then it moves onto the second job
template, which will be a success.
And then when we go into this job template,
we can see that it's just calling the debug module and printing to the screen.