The role ufrmath.computer_labs.setup_custom is used just after the installation of Ubuntu with Debian preseed to configure and customize the computers.
Initial setup
Perform initial setup just after installation is finished with Debian preseed. Configure SSH key, protect admin account, and update hostname.
- Protect admin home and add SSH key
id_key.pubto the hosts; - Configure sudo without password for user admin;
- Define hostname as defined in Ansible hosts file.
- Add ntp server from
ntp_server; - Disable crash reports;
- Configure firewall with ufw to disable all incoming except ssh.
Regenerate machine-id
Under some circumstances (custom ubuntu image, Debian preseed, same install time?), the machine-id for different machines are the same, which might trouble the DHCP server. This role generate a new random machine-id using systemd-machine-id-setup and correct the link /etc/machine-id.
If /etc/machine-id is not a link to /var/lib/dbus/machine-id:
- Restore the link;
- Delete
/etc/machine-id; - Regenerate machine-id with
systemd-machine-id-setup.
Switch from NetworkManager to networkd
Switch using netplan from NetworkManager to networkd (using DHCP).
- Add netplan to use networkd;
- Remove default NetworkManager netplan;
- Disable NetworkManager;
- Apply new netplan and reboot if required.
Configure proxy
Add proxy to environment variables and apt config.
- Add proxy to
/etc/environmentifproxy_envis defined; - Remove proxy set by Debian preseed in
/etc/apt.conf; - Add proxy for apt if
proxy_envis defined.
Customize
- Switch to standard gdm theme;
- Add SU logo to gdm login;
- Add custom dconf values, mainly:
- favorite apps
- colors
- custom text in gdm login
- logout on inactive
- proxy settings
- Hack to propagate dconf proxy settings to environments variables;
- Custom xdg directory (remove Pictures, Templates, Videos,…);
- Remove popping-up applications (gnome initial setup, reports and Deja Dup, LTS new release);
- Set admin user as system account (useful only when gdm list users);
- Allow ssh login only from user admin;
- Configure firewall with ufw to disable all incoming except ssh;
- Disable grub recovery and wayland;
- Automatic power off on idle through logind;
- Keep authenticated users for at least one year.
Custom repository
Add custom repository to apt sources.
- Add
tp-serverto/etc/hostswith ipip_server; - Setup custom apt repository with direct connection (no proxy).