Unit 2 Lab – Interacting with the Operating System Required Materials Putty or other connection tool Lab Server (Killercoda recommended: https://killercoda.com/het-tanis/course/AutomationLabs/Unit2_Interacting_with_OS ) Root or sudo command access LAB 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. Lab Setup (ProLUG Lab Only): 1. cd /root 2. cp -r /labs/automation/unit2/* /root ALTERNATIVELY (for your own lab environment) a. cd /root b. git clone https://github.com/het-tanis/prolug-labs.git c. cp prolug-labs/AutomationLabs/Unit2_Interacting_with_OS/assets/* /root 3. chmod 755 /root/*.sh 4. chmod 755 /root/*.py Bash execution: 1. Run the u2_script1.sh and look at what it shows you. a. /root/u2_script1.sh What are you shown? 2. Inspect the file and see if you can modify it to show the first 15 lines. a. cat /root/u2_script1.sh Note: Modify with vi or vim. You may have to RTFM to continue. 3. Run the u2_script2.sh and look at what it shows you. a. /root/u2_script2.sh What happened in the script? Did it work correctly? b. ls -l /root 4. 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. a. cat /root/u2_script2.sh 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: 1. Run the u2_script1.py and look at what it shows you. a. /root/u2_script1.py What are you shown? 2. Inspect the file and see if you can modify it to show the first and last 15 lines. a. cat /root/u2_script1.py Note: Modify with vi or vim. You may have to RTFM to continue. 3. Run the u2_script2.py and look at what it shows you. a. /root/u2_script2.py What are you shown? 4. 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. a. cat /root/u2_script2.py 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: 1. Run the u2_script1.yml and look at what it shows you. a. ansible-playbook /root/u2_script1.yml What are you shown? 2. Inspect the file and see if you can modify it to show the first and last 15 lines. a. cat /root/u2_script1.yml Note: Modify with vi or vim. You may have to RTFM to continue. 3. Run the u2_script2.yml and look at what it shows you. a. ansible-playbook /root/u2_script2.yml What are you shown? 4. Inspect the file and see if you can make it name the file differently or populate different content. a. cat /root/u2_script2.yml Note: Modify with vi or vim. You may have to RTFM to continue. 5. Do one final ls -l against the /root directory. What is a difference between the .sh .py and .yml files? a. ls -l 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?