Read this in other languages:
English, 日本語, Français.
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.
Before you can create a job template with a new playbook, you must first sync your Project so that Tower knows about it. To do this, click Projects and then click the sync icon next to your project. Once this is complete, you can create the job template.
Select Templates
Click the icon, and select Job Template
Complete the form using the following values
Key | Value | Note |
---|---|---|
Name | IIS Basic Job Template | |
Description | Template for the iis-basic playbook | |
JOB TYPE | Run | |
INVENTORY | Workshop Inventory | |
PROJECT | Ansible Workshop Project | |
PLAYBOOK | iis-basic/install_iis.yml |
|
CREDENTIAL | Type: Machine. Name: Student Account | |
LIMIT | windows | |
OPTIONS | [*] ENABLE FACT CACHE |
Click SAVE and then select ADD SURVEY
Complete the survey form with following values
Key | Value | Note |
---|---|---|
PROMPT | Please enter a test message for your new website | |
DESCRIPTION | Website test message prompt | |
ANSWER VARIABLE NAME | iis_test_message |
|
ANSWER TYPE | Text | |
MINIMUM/MAXIMUM LENGTH | Use the defaults | |
DEFAULT ANSWER | Be creative, keep it clean, we’re all professionals here |
Back on the main Job Template page, select SAVE again.
Now that you’ve successfully 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 real time showing you the status of the job.
Select 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
Click the rocketship icon for the IIS Basic Job Template
When prompted, enter your desired test message
Select NEXT and preview the inputs.
Sit back, watch the magic happen
One of the first things you will notice is the summary section. This gives you details about your job such as who launched it, what playbook it’s running, what the status is, i.e. pending, running, or complete.
Next you will be able to see details on the play and each task in the playbook.
When the job has successfully completed, you should see a URL to your website printed at the bottom of the job output.
If all went well, you should see something like this, but with your own custom message of course.
Now that you have IIS Installed, create a new playbook called remove_iis.yml to stop and remove IIS.
Hint: First stop the W3Svc
service using the win_service
module,
then delete the Web-Server
service using the win_feature
module.
Optionally, use the win_file
module to delete the index page.
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 Tower. The next few lessons will help you move beyond a basic playbook.