6/18
Sign inSign up free

1255. Every Run Adds Another Line

medium 20 XP ~10 minHands-on lab

The playbook /home/student/ansible/tuning.yml prepares the web servers. It was run three times last week, and now /etc/shop/limits.conf on web1 and web2 has the same lines three times, and the folder /var/lib/shop was created with the wrong permissions. Every run also reports changed for every task.

Task

Rewrite tuning.yml so that, on every host in group web:

  1. /etc/shop/limits.conf contains the line max_connections=333 exactly once, and the line timezone=Europe/Berlin exactly once. Other lines in the file stay as they are.
  2. /var/lib/shop is a directory owned by root, mode 0750.
  3. A second run of the playbook right after the first reports no changes (changed=0) on any host.

Run it from /home/student/ansible. Don't use changed_when to hide changes.

About this machine

Ubuntu 24.04 with no internet access and ansible-core installed. Three managed hosts sit next to it: web1, web2 and db1, separate machines with systemd and Python, reached over ssh as root. Only the ansible.builtin modules are available, and nothing can be downloaded. The grader runs your playbooks and checks the hosts' final state, not the commands you typed.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.