18/18
Sign inSign up free

1259. Don't Update Both Web Servers at Once

medium 20 XP ~12 minHands-on lab

/home/student/ansible/release.yml deploys a new version of the page that shopweb serves on web1 and web2 (port 8080), then restarts it. Last time both servers restarted together and the shop was down for a minute.

Task

Change release.yml and run it to release version 2.4.1 (already set in group_vars/web.yml), so that:

  1. It updates one web server at a time: the second host isn't touched until the first one is finished.
  2. After restarting a host, it checks that http://<host>:8080/ answers with status 200 and contains the new version, retrying for up to 20 seconds.
  3. If any host fails, the play stops and the remaining hosts aren't updated.
  4. Both web servers serve version 2.4.1 at the end.

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.