Launch a job with automation controller that runs a playbook using a specific execution environment, and then review the job results.
Outcomes
Create automation controller resources, such as credentials, projects, and inventories.
Create a new job template and then launch a job from the job template.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command creates the /home/student/controller-review directory, prepares automation controller and private automation hub for the exercise, and creates a Git repository that includes a playbook to test your work.
[student@workstation ~]$ lab start controller-review
Procedure 3.2. Instructions
This lab provides you with a Git repository that contains a working playbook to deploy a simple web server.
Create all resources from the automation controller web UI located at https://controller.lab.example.com.
Log in as the admin user with redhat as the password.
Create a source control credential named reviewgitcred.
The credential must belong to the Default organization.
The GitLab user for the credential is student.
Use the private key stored in the /home/student/.ssh/gitlab_rsa file on the workstation machine as the SCM private key.
Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password.
Navigate to → and click . Create the credential with the following settings and then click .
| Field | Value |
|---|---|
reviewgitcred
| |
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 area and select .
Viewing hidden files lets you see the .ssh directory in the /home/student directory.
Create a machine credential named reviewmachinecred.
The credential must belong to the Default organization.
Configure this credential for the devops user.
Use the SSH private key stored in the /home/student/.ssh/lab_rsa file.
Use sudo as the privilege escalation method and root as the privilege escalation username.
Create an inventory named reviewinventory.
The inventory must belong to the Default organization.
Add the servera.lab.example.com host to this inventory.
Create a project named reviewproject.
The project must belong to the Default organization.
This project must use the git@git.lab.example.com:student/controller-review.git Git repository and use the reviewgitcred source control credential to authenticate to the repository.
Navigate to → and then click . Create the project with the following settings and then click .
| Field | Value |
|---|---|
reviewproject
| |
Default
| |
Git
| |
git@git.lab.example.com:student/controller-review.git
| |
reviewgitcred
|
After clicking , automation controller immediately attempts to synchronize the project. The project synchronization succeeds.
If the project synchronization fails, then ensure that the project specifies the correct source control URL and credential and then attempt the project synchronization again.
Create a job template named reviewtemplate.
Configure the job template to use the reviewinventory inventory, the reviewproject project, the webserver.yml playbook, and the reviewmachinecred machine credential.
Configure the job template to use the Automation Hub Default execution environment execution environment.
Launch a job that uses the reviewtemplate job template.
If you completed the exercise correctly, then navigating to http://servera.lab.example.com displays the following message:
Successful playbook run from automation controller.
Navigate to → and then click → . Create the new job template with the following settings and then click .
| Field | Value |
|---|---|
reviewtemplate
| |
reviewinventory
| |
reviewproject
| |
Automation Hub Default execution environment
| |
webserver.yml
| |
reviewmachinecred
|
Click to create a job from the job template. The resulting job runs the playbook.
If the job fails, then ensure that the job template specifies the correct inventory and machine credential. Ensure that the machine credential uses the correct values and then launch a new job from the job template.
Click the tab. Notice that the job displays as its status.
Verify the web content updated by the job.
Either use a web browser to navigate to http://servera.lab.example.com or run the following curl command:.
[student@workstation ~]$ curl http://servera.lab.example.com
Successful playbook run from automation controller.