A set of Ansible playbooks to setup Linux machines.
site.yml is everything, in the order it has to run. It is made of two playbooks that can
also be applied on their own:
-
playbooks/common.yml: software and setup which does not require a graphical environment -
playbooks/desktop.yml: setup for desktop computers
common.yml starts with the repository set-up the rest depends on - the Extra Packages for
Enterprise Linux repos on *EL-like systems, and removing snap on Debian and Ubuntu. Both are
no-ops everywhere else.
|
the plays, which are lists of roles and nothing else |
|
all the logic, one role per thing being set up |
|
third-party roles, see the licence section below |
|
the machines to apply this to: |
|
container and VM test setups |
|
the wrappers documented below |
Every role carries its own defaults in roles/<role>/defaults/main.yml, which is where the
package lists live. The few variables shared by more than one role, username above all,
are in playbooks/group_vars/all/defaults.yml.
To change any of them, put the keys into playbooks/group_vars/all/local.yml. That file is
gitignored and picked up automatically, so no extra flag is needed:
username: alice directories_paths: - "~/code"
Only the keys present in that file are overridden, the rest keep their defaults. Leaving the file out entirely is fine.
Everything below needs git, ansible, curl, bash and unzip installed:
Fedora |
|
*EL-like |
|
Ubuntu/Debian |
|
openSUSE |
|
Arch Linux |
|
git clone https://github.com/fwilhe2/system-automation.git cd system-automation ansible-galaxy install -r requirements.yml
|
❗
|
The ansible-galaxy step is not optional. Several roles use modules from
community.general, and the first one of them runs early in the common playbook.
|
ansible-playbook --ask-become-pass site.yml ansible-playbook --ask-become-pass playbooks/common.yml # just the headless half
ansible.cfg names the inventory and the role paths, so both commands need no flags - but
they have to be run from the root of the checkout, which is where ansible.cfg is found.
|
|
Ubuntu 25.10 and later, including 26.04, default to sudo-rs instead of sudo.
Older ansible-core releases don’t recognize the password prompt sudo-rs prints, so
--ask-become-pass hangs or fails with a privilege escalation error even with the right
password. This is fixed upstream, but the
ansible-core version apt install ansible pulls on Ubuntu 26.04 may predate the fix.
Install a current ansible-core with pipx install ansible-core (or pip install --user
ansible-core) and use that instead of the distro package if you hit this.
|
scripts/run.sh wraps that, taking the playbook name without the .yml suffix and
defaulting to everything:
./scripts/run.sh ./scripts/run.sh desktop
Roles are tagged with their own name, so a single one can be applied on its own:
ansible-playbook --ask-become-pass playbooks/desktop.yml --tags firefox
Anything after the playbook name goes to ansible-playbook, so any tag below can be
skipped (several at once, comma-separated):
./scripts/run.sh --skip-tags docker,firefox # opt out of single roles ./scripts/run.sh --skip-tags upstream # only what the distro repositories carry
Ansible stops at the first failing task. If a single role is broken - typically an
upstream one whose download site is down - --keep-going applies the roles one at a time
instead, asks for the password once, and lists the failed ones at the end together with
the --skip-tags that leaves them out next time:
./scripts/run.sh --keep-going ./scripts/run.sh --keep-going desktop --skip-tags upstream
That is slower, as every role gathers facts again, so it is meant for the run after a failure rather than as the default.
| Tag | Selects |
|---|---|
|
roles that download from outside the distribution’s repositories (GitHub, vendor repositories, …) |
|
EPEL repository on EL |
|
removal of snap |
|
basic packages |
|
oh-my-zsh and the dotfiles repository |
|
the |
|
directories in the home directory |
|
Docker |
|
compilers, toolchains, development packages |
|
rustup |
|
uv |
|
virtualization tools and lima |
|
gcl |
|
GitHub CLI |
|
telemetry opt-outs |
|
VSCodium and its extensions |
|
VSCodium extensions only |
|
Firefox Nightly |
|
Tor Browser |
|
RPM Fusion on Fedora |
|
desktop packages |
|
LibreOffice settings |
|
grind |
|
spellchecking dictionaries |
A Containerfile exists per package manager, and all of them are built and run by the CI
workflow. They apply common.yml and desktop.yml, each one twice to check idempotence
(test/container/run-test.py), and then assert properties of the resulting system
(test/container/assertions.py).
scripts/container-test.sh builds and runs one of them. The CI workflow calls the same
script, so a green run here is the run CI makes. It takes distro[:version], where the
version defaults to the first one listed in its --help, and it uses podman when
available and docker otherwise:
./scripts/container-test.sh # fedora:latest, the full test suite ./scripts/container-test.sh debian # debian:testing ./scripts/container-test.sh debian:unstable ./scripts/container-test.sh fedora:rawhide bash # ... with a shell instead of the test runner ./scripts/container-test.sh --help # the distros and versions on offer
Inside an interactive container, python3 test/container/run-playbook.py <name> applies a
single playbook without the assertions.
Every Containerfile takes the image to build on as its VERSION build argument, so building
one by hand is:
docker build --build-arg=VERSION=debian:testing -t system-automation-test --file test/container/Containerfile.dpkg . docker run --tty system-automation-test
The containers escalate privileges against test/container/inventory.yml, which carries the
throwaway root password the images are built with, using the method named in each image’s
ANSIBLE_BECOME_METHOD.
|
📎
|
Containerfile.archlinux applies common.yml directly instead of running
run-test.py, so the Arch job checks that the playbook succeeds but not the assertions.
|
|
📎
|
When running an image with podman by hand, add --env SYSTEMD_OFFLINE=1, which is
what container-test.sh does. None of the images run systemd, and ansible’s systemd module
only notices that by itself under docker; under podman the docker role fails with "Service
is in unknown state".
|
Lima is a tool written in go for running virtual machines.
test/lima/ holds vm definitions for testing this repo:
# boot both fedora and debian limactl start --yes test/lima/fedora.yaml limactl start --yes test/lima/debian.yaml # run the common playbook on both vms ansible-playbook --inventory inventories/lima/hosts.yml playbooks/common.yml # inspect the vms if needed limactl shell fedora limactl shell debian # remove the vms when you're done limactl delete -f fedora debian
The vm definitions pin the image location and its digest, so they go stale when a new
release is published. test/lima/update-fedora-image.py refreshes those fields in
test/lima/fedora.yaml.
The CI with Lima VM workflow runs the same thing on GitHub Actions, but only when
triggered manually via workflow_dispatch.
Copyright © 2016-2026 Florian Wilhelm
Free use of this software is granted under the terms of the MIT License.
This project ships the following 3rd party software. The copies below have been modified, so they do not match their upstream projects:
- ansible-role-codium (
vendor/roles/greenleader.codium) -
Copyright © Sion Fandrick under the MIT License
- ansible-role-vscode (
vendor/roles/iesplin.vscode) -
Copyright © iesplin under the MIT License
- ansible-role-visual-studio-code-extensions (
roles/vscodium/library/codium_extensions.py) -
Copyright © John Freeman GantSign Ltd. Company No. 06109112 (registered in England) under the MIT License
- Ansible collection - gotmax23.epel (
vendor/roles/gotmax23.epel*,roles/epel) -
Copyright © 2022 Maxwell G (@gotmax23) under the MIT License
- lima - linux virtual machines (
test/lima/*.yaml) -
Based on examples by Akihiro Suda and the lima contributors under the Apache-2.0 license
- Ansible Role: snapd (
vendor/roles/bodsch.ansible-snapd) -
Copyright © Bodo Schulz under the BSD-2-Clause License