Step 5 of 6 · lab · 25 min
An unfinished playbook
The shop status page is to be set up with an Ansible playbook instead of by hand. The playbook is started, but it fails and does not do everything. Finish it so that it sets the machine up by itself and a second run changes nothing.
Situation
The shop servers need a status page. The status-board application is already installed
(/usr/local/bin/status-board), but nobody wants to set it up by hand on every server. Timur started an Ansible
playbook in ~/status-board and did not get to finish it: ansible-playbook site.yml fails right now.
Task
Finish site.yml so that it brings this machine (localhost from inventory.ini) to the needed state by itself:
- The
statususer is a system user without a login shell (the playbook already has a task for it). - The
/var/lib/statusdata directory: owner and groupstatus, mode0750. - The
/etc/status/status.inisettings come from thetemplates/status.ini.j2template with the variables from the playbook'svars:: owner root, groupstatus, mode0640. - The
lab-statusservice (the unit isfiles/lab-status.service) is running, enabled at boot and answers:curl http://127.0.0.1:8095/. - Running the playbook again changes nothing: the recap says
changed=0.
"Check" runs the playbook by itself. First it removes what the playbook must create: the lab-status service with
its unit, /etc/status, /var/lib/status and the status user. Then it runs ansible-playbook site.yml from
~/status-board twice, as you. So the playbook must do everything — the check removes whatever you set up by hand.
Do not change the application, the files/lab-status.service file or the variables in vars:.
To run it:
cd ~/status-board && ansible-playbook site.yml. Module help —ansible-doc file. There is no internet on the machine.
Lab · on your own
No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.
Goals
0 of 5-
ansible-playbook site.yml runs without errors on a machine without the status page — not done yet
-
The playbook creates the status system user and the /var/lib/status directory (status:status, 0750) — not done yet
-
/etc/status/status.ini is built from the templates/status.ini.j2 template (root:status, 0640) — not done yet
-
The lab-status service is running, enabled at boot and answers http://127.0.0.1:8095/ — not done yet
-
A repeated run changes nothing — changed=0 — not done yet
The machine is starting
Hints
0 of 3Lab goals
0 of 5-
ansible-playbook site.yml runs without errors on a machine without the status page — not done yet
-
The playbook creates the status system user and the /var/lib/status directory (status:status, 0750) — not done yet
-
/etc/status/status.ini is built from the templates/status.ini.j2 template (root:status, 0640) — not done yet
-
The lab-status service is running, enabled at boot and answers http://127.0.0.1:8095/ — not done yet
-
A repeated run changes nothing — changed=0 — not done yet
Goals are checked on the machine after every command.