Skip to content

Latest commit

 

History

History
executable file
·
130 lines (92 loc) · 3.75 KB

Creating-and-Running-a-Job-Template.adoc

File metadata and controls

executable file
·
130 lines (92 loc) · 3.75 KB

Exercise 1.3 - Creating and Running a Job Template

A job template is a definition and set of parameters for running an Ansible job.

Job templates are useful to execute the same job many times.

Creating a Job Template

Step 1:

Select TEMPLATES icon templates

Step 2:

Click on ADD Job Template add job template

Step 3:

Complete the form using the following values and SAVE

NAME

Apache Basic Job Template

DESCRIPTION

Template for the apache-basic-playbook

JOB TYPE

Run

INVENTORY

Ansible Workshop Inventory

PROJECT

Ansible Workshop Project

PLAYBOOK

examples/apache-basic-playbook/site.yml

CREDENTIAL

Ansible Workshop Credential

LIMIT

web

OPTIONS

enable priviledge

detail job template

Figure 11: Job Template Form

Step 4:

Select SAVE save

Step 5:

Select ADD SURVEY add survey

Step 6:

Complete the survey form with following values

PROMPT

Please enter a test message for your new website

DESCRIPTION

Website test message prompt

ANSWER VARIABLE NAME

apache_test_message

ANSWER TYPE

Text

MINIMUM/MAXIMUM LENGTH

Use the defaults

DEFAULT ANSWER

Be creative, keep it clean, we’re all professionals here

survey form

Figure 12: Survey Form

Step 7:

Select ADD add

Step 8:

Select SAVE save

Step 9:

Back on the main Job Template page, select SAVE save again.

Running a Job Template

Now that you’ve sucessfully created your Job Template, you are ready to launch it. Once you do, you will be redirected to a job screen which is refreshing in realtime showing you the status of the job.

Step 1:

Select JOB TEMPLATES icon templates

Note
Alternatively, if you haven’t navigated away from the job templates creation page, you can scroll down to see all existing job templates

Step 2:

Click on the rocketship icon rocket for the Apache Basic Job Template

Step 3:

When prompted, enter your desired test message

survey prompt

Figure 13: Survey Prompt

Step 4:

Select LAUNCH launch

Step 5:

Sit back, watch the magic happen

Once the job is running, on the left, you’ll have details in regards to what playbook it’s running, what the status is, i.e. pending, running, or complete. You’ll also notice the apache_test_message being passed in as an 'extra_variable.'

To the right, you can view standard output; the same way you could if you were running Ansible Core from the command line.

job summary

Figure 14: Job Summary

You can also click on the nodes in the standard output under a specific task for additional information. ---

play and task details

Figure 15: Play and Task Details

Step 6:

Once your job is sucessful, navigate to your new website

If all went well, you should see something like this, but with your own custom message of course.

new website

Figure 17: New Website with Personalized Test Message

End Result

At this point in the workshop, you’ve experienced the core functionality of Ansible Tower. But wait…? there’s more! You’ve just begun to explore the possibilities of Ansible Core and Tower. Take a look at the resources page in this guide to explore some more features.