Navigate through the automation controller web UI and launch a job.
Outcomes
Create source control and machine credentials.
Create a project.
Create an inventory that uses an inventory file from the project.
Create a new job template.
Launch a job template and review the output generated by the job.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command creates the Git repository used by this exercise.
[student@workstation ~]$ lab start controller-playbooks
Procedure 3.1. Instructions
This exercise provides you with an Ansible project in a Git repository that contains a working playbook to deploy a simple web server.
Automation controller must have a source control credential to access content from a Git repository.
From the automation controller web UI, create a source control credential named Git Project Credential.
Configure this credential to use authentication information for the git.lab.example.com server.
Navigate to https://controller.lab.example.com and log in as admin using redhat as the password.
Navigate to → and click . Create the credential with the following settings and then click .
| Field | Value |
|---|---|
Git Project Credential
| |
Default
| |
Source Control
| |
student
| |
Content of the /home/student/.ssh/gitlab_rsa file. |
If you choose to browse for the file, then right-click anywhere in the directory navigation and select .
With this option enabled you can see the .ssh directory in the /home/student directory.
To run the playbook against each managed host, automation controller must have a machine credential that contains authentication information.
Create a machine credential named Devops Machine Credential that contains authentication information for the managed hosts in the classroom environment.
Navigate to → and click . Create the credential with the following settings and then click .
| Field | Value |
|---|---|
Devops Machine Credential
| |
Default
| |
Machine
| |
devops
| |
Content of the /home/student/.ssh/lab_rsa file. | |
sudo
| |
root
|
If you choose to browse for the file, then right-click anywhere in the directory navigation and select .
This lets you see the .ssh directory in the /home/student directory.
Create a project named Controller Playbooks Project.
This project points to a Git repository that contains a playbook and an inventory file.
Configure the project to specify a default automation execution environment.
Navigate to → and then click . Create the project with the following settings and then click .
| Field | Value |
|---|---|
Controller Playbooks Project
| |
Default
| |
Automation Hub Default execution environment
| |
Git
| |
git@git.lab.example.com:student/controller-playbooks.git
| |
Git Project Credential
| |
Allow Branch Override
|
After you click , automation controller immediately attempts to synchronize the project. The project synchronization should succeed.
If synchronization fails, ensure that the project specifies the correct source control URL and credentials and then attempt the project synchronization again.
Create an inventory for this exercise named Controller Playbooks Inventory (Dev) using the inventory file in the project repository.
Managing your inventory file in a Git repository enables you to benefit from storing your changes in a version control system. You can also update it by editing the file rather than manually updating inventory information in the automation controller web UI.
Navigate to → and then click → .
Create a new inventory with the following settings and then click .
| Field | Value |
|---|---|
Controller Playbooks Inventory (Dev)
| |
Default
|
From the tab, click . Create a new inventory source with the following settings and then click .
After selecting the project, you might see the following error message: That value was not found. Please enter or select a valid value.
The error message disappears when you select the inventory file.
| Field | Value |
|---|---|
Controller Playbooks Source (Dev)
| |
Sourced from a Project
| |
Controller Playbooks Project
| |
inventory
| |
Update on project update
|
Click in the breadcrumb navigator and then click the icon for the source. The status updates to indicate that the synchronization succeeded.
Click the tab.
The inventory source imported the serverf.lab.example.com host.
Click the tab.
The inventory source imported the web group.
Click and then click the tab.
The web group contains the serverf.lab.example.com host.
Create a job template named Basic Web.
Configure the job template to run the basic-web-fqcn.yml playbook using the default automation execution environment for the project.
The playbook ensures that a web server and its content are deployed on hosts in the web inventory host group.
Navigate to → and then click → . Create the new job template with the following settings, and then click .
| Field | Value |
|---|---|
Basic Web
| |
Controller Playbooks Inventory (Dev)
| |
Controller Playbooks Project
| |
basic-web-fqcn.yml
| |
Devops Machine Credential
|
Click to run the job template. The resulting job successfully runs the playbook.
Navigate to → and look for a numbered job with Basic Web in the name.
By default, automation controller lists the most recent jobs at the top.
The Basic Web job displays a status of .
(Optional) Click the name of the Basic Web job to review the job output.
This is the same output that you initially saw when you launched the job.
Verify that the job successfully deployed a web server on serverf.lab.example.com.
From a terminal window, run the curl command to access web content at http://serverf.lab.example.com.
[student@workstation ~]$ curl http://serverf.lab.example.com
Hello world from serverf.lab.example.com.