Unit 14 Lab - Ansible Automation
Info
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
- Rocky 9.4+ - ProLUG Lab
- Or comparable Linux box
- root or sudo command access
Downloads
The lab has been provided for convenience below:
Warmup Exercises
Quickly run through your system and familiarize yourself:
Lab Exercises
Create an Inventory File
While in /root/ansible_madness, create a file called hosts:
Add the following contents:
Run Ad Hoc Commands
Test connectivity into the servers
- Use password:
LinuxR0cks1!
Verbose version:
Create a Playbook to Push Files
- Create a test file:
- Create
deploy.yaml:
---
- name: Start of push playbook
hosts: servers
vars:
gather_facts: True
become: False
tasks:
- name: Copy somefile over at {{ ansible_date_time.iso8601_basic_short }}
copy:
src: /root/ansible_madness/somefile
dest: /tmp/somefile.txt
- Run the playbook:
- Verify the file was pushed everywhere:
Pull Down a GitHub Repo
Then reflect:
- What do you see in here?
- What do you need to learn more about to deploy some of these tools?
- Can you execute some of these? Why or why not?
Info
Be sure to reboot the lab machine from the command line when you are done.