trixie/edubox.yml

71 lines
2.1 KiB
YAML
Raw Normal View History

---
2021-11-12 16:46:41 +01:00
## This playbook deploys a series of minimal systemd-nspawn containers
## for educational use on a host, for example to learn ansible!
## All containers use an apt cache on the host system and forward port
## 22 (ssh), 80 (http) and 443 (https) to ports >= 10000, 10100 and 10200
2021-11-20 14:38:22 +01:00
## respectively. A user 'ansi' in the 'sudo' group is prepared,
2021-11-12 16:46:41 +01:00
## either with empty password or an initial password to be set below.
##
## Modifications of the initial containers are kept in an overlay
## directory next to the container images in '/var/lib/machines/'.
## This allows to visit and compare the work of students on the host.
## To manage the containers after installation, run the playbook with
## one of the the following tags:
##
## --tags=start start all containers
## --tags=stop stop all containers
## --tags=reset reset all containers to the initial image
## --tags=purge purge all containers
## --tags=setup purge all containers and setup again
2021-11-12 16:46:41 +01:00
##
- name: apply configuration to the edubox
hosts: all # eduboxes
remote_user: ansible
become: yes
vars:
contname: cont
2021-11-18 20:22:00 +01:00
## User name for the user in the container:
contuser: ansi
## Password for the user 'ansible' in the container,
## leave empty to log in without password:
contpwd: ""
2021-11-12 16:46:41 +01:00
## Adjust the number of containers here:
containers: "{{ range(0, 9 + 1) | list }}"
2021-11-20 14:38:22 +01:00
## Additional packages to be installed in the container:
cont_packages_extra:
- bind9-dnsutils
- file
- locales
- xz-utils
- lsof
- wget
- bind9-host
- libc-l10n
- traceroute
- bzip2
- netcat-traditional
- telnet
2021-11-12 11:07:07 +01:00
pre_tasks:
2021-11-16 20:39:23 +01:00
- name: install apt-cacher-ng
apt:
name: apt-cacher-ng
state: latest
2021-11-12 11:07:07 +01:00
- name: enable apt-cacher-ng
lineinfile:
path: /etc/apt/apt.conf.d/30proxy
line: 'Acquire::http::Proxy "http://localhost:3142/";'
create: yes
- name: enable and start systemd-networkd on the host
systemd:
name: systemd-networkd
state: started
enabled: yes
roles:
- up2date-debian
- educontainer