Bookmark this page

Performing Lab Exercises

Run the lab command from workstation to prepare your environment before each hands-on exercise, and again to clean up after an exercise. Each hands-on exercise has a unique name within a course.

There are two types of exercises. The first type, a guided exercise, is a practice exercise that follows a course narrative. If a narrative is followed by a quiz, it usually indicates that the topic did not have an achievable practice exercise. The second type, an end-of-chapter lab, is a gradable exercise to help to verify your learning. When a course includes a comprehensive review, the review exercises are structured as gradable labs.

The syntax for running an exercise script is as follows:

[student@workstation ~]$ lab action exercise

The action is a choice of start, grade, or finish. All exercises support start and finish. Only end-of-chapter labs and comprehesive review labs support grade.

start

A script's start logic verifies the required resources to begin an exercise. It might include configuring settings, creating resources, checking prerequisite services, and verifying necessary outcomes from previous exercises. With exercise start logic, you can perform any exercise at any time, even if you did not perform prerequisite exercises.

grade

End-of-chapter labs help to verify what you learned, after practicing with earlier guided exercises. The grade action directs the lab command to display a list of grading criteria, with a PASS or FAIL status for each. If the grade action shows a FAIL status, then it also shows information so you can detect which step is failing. Moreover, it logs the errors as it is explained in the next section. To achieve a PASS status for all criteria, fix the failures and rerun the grade action.

finish

A script's finish logic deletes exercise resources that are no longer necessary. With cleanup logic, you can repeatedly perform an exercise, and it helps course performance by ensuring that unneeded objects release their resources.

To list the available exercises, use tab completion in the lab command with an action:

[student@workstation ~]$ lab start Tab Tab
auto-ha                       gfs-manage                    resources-group
auto-res                      gfs-review                    resources-manage
auto-review                   iscsi-initiator               resources-review
cluster-create                iscsi-review                  spof-fencing

Troubleshooting Lab Scripts

All the exercise scripts are stored on the workstation machine in the /home/student/.venv/labs/lib/python3.6/site-packages/rh445/ansible directory. When you run the lab command with a valid exercise and action, it creates one log file in /tmp/log/labs, plus the directory if it does not exist. The file, named exercise, captures error messages that are normally displayed on your terminal.

[student@workstation ~]$ ls -l /tmp/log/labs/
-rw-rw-r--. 1 student student 7520 Apr 30 05:34 cluster-review

Interpreting the Exercise Log Files

Exercise scripts send output to the log file when the scripts fail. Thus, the exercise log is useful for troubleshooting. Because the exercise scripts are based on Ansible Playbooks, system administrators should recognize common error message entries.

Although exercise scripts are always run from workstation, they perform tasks on other systems in the course environment. Many course environments, including OpenStack and OpenShift, use a command-line interface (CLI) that is invoked from workstation to communicate with server systems by using API calls. Because script actions typically distribute tasks to multiple systems, additional troubleshooting is necessary to determine where a failed task occurred. Log in to those other systems and use Linux diagnostic skills to read local system log files and determine the root cause of the lab script failure.

Revision: rh445-8.4-4e0c572