setup_custom role – Setup and customize lab’s computers

Note

This role is part of the ufrmath.computer_labs collection (version 1.0.0).

To install it use: ansible-galaxy collection install git+https://github.com/guillod/computer_labs.

To use it in a playbook, specify: ufrmath.computer_labs.setup_custom.

Entry point custom – Customize the computers

Synopsis

  • Switch to standard gdm theme;

  • Add SU logo to gdm login;

  • Add custom dconf values (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;

  • Disable grub recovery and wayland;

  • Automatic power off on idle through logind;

  • Keep authenticated users for at least one year;

Entry point initial – Perform initial setup

Synopsis

  • Run on clean Ubuntu Desktop installation having openssh-server installed;

  • On first run, might have to populate ansible_ssh_pass and ansible_become_pass.

  • On first run, wait for SSH to be ready and add SSH fingerprint to local ~/.ssh/known_hosts;

  • Protect admin home and add SSH key id_key.pub to 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;

Parameters

Parameter

Comments

ntp_server

string

ntp server

Default: "ntp.ubuntu.com"

Entry point machine_id – Regenerate machine-id

Synopsis

  • Under some circumstances (custom ubuntu image, Debian preseed, same install time?), the machine-id for different machines are the same;

  • If /etc/machine-id is not a link to /var/lib/dbus/machine-id: restore the link and regenerate machine-id with systemd-machine-id-setup.

Entry point main – Setup and customize lab’s computers

Synopsis

  • Initial setup

  • Modify machine ID

  • Setup netplan

  • Reboot if required

  • Define proxy

  • Customize

  • Define custom repository

Parameters

Parameter

Comments

custom_repository

string

custom repository

ip_server

string

server ip to add to /etc/hosts

ntp_server

string

ntp server

Default: "ntp.ubuntu.com"

Entry point netplan – Switch from NetworkManager to networkd

Synopsis

  • Switch using netplan from NetworkManager to networkd (using DHCP).

  • Add netplan to use networkd;

  • Remove default NetworkManager netplan;

  • Disable NetworkManager;

  • Apply new netplan.

Entry point proxy – Add proxy to environment variables and apt config

Synopsis

  • Add proxy to /etc/environment if proxy_env is defined;

  • Add proxy for apt if proxy_env is defined;

Entry point repository – Add custom repository to apt sources

Synopsis

  • Add tp-server to /etc/hosts with ip ip_server;

  • Setup custom apt repository with direct connection (no proxy).

Parameters

Parameter

Comments

custom_repository

string

custom repository

ip_server

string

server ip to add to /etc/hosts