Unit 2 Lab
Interacting with the Operating System
This lab is designed to have the engineer verify and execute their automation tools to interact with the OS in a controlled fashion.
If you do the Killercoda Lab 2, just answer these questions.
If you are doing the lab in the ProLUG environment, find the scripts
in /labs/automation/unit2.
Note
If you are unable to finish the lab in the ProLUG lab environment we ask you reboot
the machine from the command line so that other students will have the intended environment.
Resources / Important Links
Required Materials
- Lab Server (Killercoda recommended)
- Rocky 9.4+ - ProLUG Lab
- Or comparable Linux box
rootorsudocommand access
Downloads
The lab has been provided for convenience below: - u2_lab.txt - u2_lab.md
Pre-Lab (Lab Setup)
If you're not doing the lab on Killercoda, make sure to follow the setup guide below.
ProLUG Lab Setup
If you're using the ProLUG lab environment, run the following commands.
| prolug-lab-setup | |
|---|---|
Personal Lab Setup
Alternatively, for your own lab environment, clone down the necessary files
from GitHub.
| lab-setup | |
|---|---|
Lab 🧪
In this lab, we will go through the process of executing our automation tools.
Bash Execution
-
Run the
u2_script1.shand look at what it shows you.- What are you shown?
-
Inspect the file and see if you can modify it to show the first 15 lines.
-
Note
Modify with vi or vim. You may have to RTFM to continue.
-
-
Run the u2_script2.sh and look at what it shows you.
- What happened in the script?
- Did it work correctly?
-
Inspect the file and see if you can make it use a different date format. You may have to read the man pages for date command.
As you're interacting with the OS, are there any observations you have about how the scripts are set up, their structure and their output.
-
Is there anything you would add for your scripts?
-
If you would add something, how does it improve the code?
Python Execution
-
Run the u2_script1.py and look at what it shows you.
- What are you shown?
-
Inspect the file and see if you can modify it to show the first and last 15 lines.
-
Note
Modify withviorvim. You may have to RTFM to continue.
-
-
Run the u2_script2.py and look at what it shows you.
- What are you shown?
-
Inspect the file and see if you can make it use a different user shell, maybe one you've seen from other output in this lab.
-
Note
Modify with vi or vim. You may have to RTFM to continue.
-
As you're interacting with the OS, are there any observations you have about how the scripts are set up, their structure and their output.
-
Is there anything you would add for your scripts?
-
If you would add something, how does it improve the code?
Ansible Execution
-
Run the u2_script1.yml and look at what it shows you.
- What are you shown?
-
Inspect the file and see if you can modify it to show the first and last 15 lines.
-
Note
Modify with vi or vim. You may have to RTFM to continue.
-
-
Run the u2_script2.yml and look at what it shows you.
- What are you shown?
-
Inspect the file and see if you can make it name the file differently or populate different content.
-
Note
Modify with vi or vim. You may have to RTFM to continue.
-
-
Do one final
ls -lagainst the/rootdirectory. What is a difference between the.sh,.py, and.ymlfiles?
As you're interacting with the OS, are there any observations you have about how the scripts are set up, their structure and their output.
-
Is there anything you would add for your scripts?
-
If you would add something, how does it improve the code?
Note
If you are unable to finish the lab in the ProLUG lab environment we ask you reboot
the machine from the command line so that other students will have the intended environment.