Module 2 · Project 02 · Automated Server Configuration with Ansible · Lesson 10 of 48
Build it: from fresh server to configured server
Build the playbook in five stages, document it, and test yourself on configuration management.
In this lesson · about 40 minutes
- Build and verify the playbook stage by stage
- Prove it is idempotent and works for several environments
- Explain Ansible concepts in interview language
The goal
Fresh server → ansible-playbook → fully configured web server, in one command, as often as you like.
Build it in five stages
- Packages. Inventory with one test server; a play that installs
curl git ufw fail2ban. Run it twice and see changed drop to 0. - Users. Create
deploy, add its SSH key, give it sudo. Log in as deploy to check. - Services. Harden SSH with lineinfile + handler; install Nginx; allow 22/80/443 then enable ufw; start and enable Nginx.
- Application config. Create
/var/www/appwith the file module, deploy anindex.htmlwith copy and a site config with template (withvalidate), and restart via a handler. Bonus: install your Project 01 toolkit and its cron jobs with Ansible'scronmodule. - Idempotent and multi-environment. Second run shows
changed=0;--check --diffis clean; inventories for dev and staging (two VMs, or one VM pretending) with different variables.
Suggested repository
server-config/
├── ansible.cfg
├── site.yml
├── inventories/{dev,staging,production}/
├── roles/
│ ├── base/ # packages, users, ssh
│ ├── firewall/
│ └── nginx/ # tasks, handlers, templates
├── files/deploy.pub
└── README.md
Break it on purpose
- Change
sshd_configby hand on the server, then run with--check --diff. Did Ansible spot the drift? - Put a typo in the Nginx template. Did
validatestop the broken file from going live? - Switch a VM off mid-run. What does the recap say, and does a re-run finish the job?
Write each one up in your README's "Failure" section. Under "Security", list what the playbook hardens: key-only SSH, firewall, fail2ban, a non-root deploy user.
Guided dialogue
Mock interview: configuration management
0 of 4 answered
Four questions you're likely to hear once Ansible is on your CV.
What does idempotent mean, and why does it matter in Ansible?
Flashcards
Project 02 flashcards
0 of 10 known
Say the answer out loud, flip the card, then be honest: cards you miss come back at the end.
Practice exam
Project 02 practice test
Ten questions, 12 minutes. Every answer is explained when you submit.
- 10 questions · 12 minutes
- No feedback until you submit. Flag questions to come back to them.
- Aim for 85% or better before you move on. The real exam's 750 out of 900 is roughly 80–83%.
Write the 'Architecture' and 'Technology' sections for your server-config project.
Consider these questions and write down your thoughts. What you write stays on this device.
Written by Noviq Academy in its own words. The labs are simulations: no real servers are touched. When you build the projects yourself, use a practice virtual machine or a free-tier cloud account you control, watch your cloud spending, and never run cleanup or delete commands on a machine you care about. Tool names belong to their owners; versions and output are shown for learning and may differ slightly from yours. Read-aloud and the whiteboard voice use your device's built-in voices.