Create a new project and job template, and assign an appropriate role for a team to be able to launch a job.
Outcomes
Create a project.
Create a job template.
Allow a team to launch a job using a job template.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command ensures that automation controller is installed and configured with any necessary resources created in previous exercises.
[student@workstation ~]$ lab start provision-review
Procedure 4.3. Instructions
Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password.
Create a new project called My Webservers with the following information:
Table 4.1. New Project Details
| Field | Value |
|---|---|
My Webservers
| |
Webservers Project
| |
git@git.lab.example.com:git/my_webservers.git
| |
Navigate to → and then click .
Create the new project using the information in the table. When finished, click .
Automation controller automatically attempts to synchronize the new project. On the page for the project, verify that the field displays the message.
If the project synchronization fails, then ensure that the project specifies the correct source control URL and the correct source control credential.
Give the Developers team both the Use and the Update roles on the My Webservers project.
Navigate to → and click the link.
Click the tab and then click .
Select and then click .
Select and then click .
Select both and and then click to assign the roles. This redirects you to the list of permissions for the project. The and users have the and roles because they belong to the Developers team.
Create a new job template called TEST webservers setup with the following information:
Give the Developers team the Execute role on the TEST webservers setup job template.
Clone the https://git.lab.example.com/git/my_webservers.git Git repository into the /home/student/git-repos directory.
From a terminal, create the /home/student/git-repos directory if it does not already exist, and then change into it.
[student@workstation ~]$mkdir -p ~/git-repos/[student@workstation ~]$cd ~/git-repos/
Clone the https://git.lab.example.com/git/my_webservers.git repository and then change into the cloned repository:
[student@workstation git-repos]$git clone \>https://git.lab.example.com/git/my_webservers.gitCloning into 'my_webservers'... ...output omitted... [student@workstation git-repos]$cd my_webservers
Edit the ~/git-repos/my_webservers/templates/index.html.j2 Jinja2 template file. Add the highlighted Host IP Address line so that the file has the following content. Add and commit your changes to your Git repository, and then push your changes to the remote repository.
Current Host: {{ ansible_facts['fqdn'] }} <br>
Host IP Address: {{ ansible_facts['default_ipv4']['address'] }} <br>
Server list: <br>
{% for host in groups['all'] %}
{{ host }} <br>
{% endfor %}Edit the ~/git-repos/my_webservers/templates/index.html.j2 file so that it contains the previously displayed Host IP Address line.
Use the git add command to add the modified file to the next Git commit.
[student@workstation my_webservers]$ git add templates/index.html.j2Commit your changes to your local Git repository.
[student@workstation my_webservers]$ git commit -m "Added Host IP Address"
[main 373e307] Added Host IP Address
1 file changed, 1 insertion(+)Use the git push command to push the changes to the remote Git repository.
[student@workstation my_webservers]$ git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 524 bytes | 524.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
To https://git.lab.example.com/git/my_webservers.git
abd5989..373e307 main -> mainTest the project and job template permissions that you previously assigned to the Developers team. Log in as david using redhat123 as the password, update the My Webservers project, and then launch a job using the TEST webservers setup job template. When finished, log out of the automation controller web UI.
From the automation controller web UI, click → and then log in as david using redhat123 as the password.
Navigate to → and then click the icon for the project.
Navigate to → and then click the icon for the job template.
Observe the live output of the running job.
Click the tab and verify that the field displays the message. This step could take several seconds or minutes to complete depending of the size of the Git repository,
From the automation controller web UI, click → .
Verify the web content displayed on http://serverc.lab.example.com and http://serverd.lab.example.com. The web pages should display the fully qualified domain name and IP address of the current host.
From a terminal window, use the curl command to review the web content on http://serverc.lab.example.com and http://serverd.lab.example.com.
[student@workstation my_webservers]$for X in server{c,d}.lab.example.com>do curl http://${X}>echo>doneCurrent Host: serverc.lab.example.com <br> Host IP Address: 172.25.250.12 <br> Server list: <br> serverc.lab.example.com <br> serverd.lab.example.com <br> Current Host: serverd.lab.example.com <br> Host IP Address: 172.25.250.13 <br> Server list: <br> serverc.lab.example.com <br> serverd.lab.example.com <br>
Alternatively, review the content of both http://serverc.lab.example.com and http://serverd.lab.example.com in a graphical web browser such as Firefox.