Ansible course
CHAPTER 08
Practice Lab
Build and run your own playbook
15 min read3 sections
In this chapter
Your turnChallengesNext steps
01Your turn
Write a playbook below. The simulator checks if your playbook has the right structure (tasks, modules, correct YAML).
Think: Start simple: install a package, start a service. Then add variables, handlers, and conditionals.
02Challenges
Try these challenges to test your knowledge.
- ▸Challenge 1: Install and configure nginx with a handler to restart on config change.
- ▸Challenge 2: Create a user 'deploy' with sudo access and an SSH key.
- ▸Challenge 3: Deploy an app: clone a Git repo, install dependencies, start as a service.
- ▸Challenge 4: Configure a Cisco switch with VLANs and access ports.
03Next steps
1. Install Ansible: pip install ansible. 2. Create an inventory file with your servers. 3. Write your first playbook and run it with ansible-playbook playbook.yml. 4. Explore Ansible Galaxy for community roles. 5. Learn about Ansible Vault for secrets management.
Check your understanding
0 / 1 correct
What is the Ansible command to run a playbook?