This repository is a collection of scripts and Ansible playbooks that I used to provision all of my machines, from laptop to servers.
-
arch_install.sh
script will install Arch Linux, based on my installation notes. This script will cover the Pre-installation, Installation, and Configure the system sections. It will also configure OpenSSH server, firewall, and user creation in the Post-installation section. The remaining Post-installation steps are covered by Ansibleroles/archlinux_common
androles/gui
. -
arch_install_bcachefs.sh
script will install Arch Linux with bcachefs instead, based on my installation notes. Bcachefs is still considered as experimental, so make sure you have a working backup. Similarly, it will cover the Pre-installation, Installation, and Configure the system sections. In addition, it will also configure OpenSSH server, firewall, and user creation in the Post-installation section. The remaining Post-installation steps are covered by Ansibleroles/archlinux_common
androles/gui
. The script is designed to work on bcachefs with single drive or multiple drives setup. But current only single drive without encryption setup works. -
mkarchiso.sh
will create a latest Arch Linux ISO under/tmp
directory with optionally additional kernel parameters. It will also copy installation scripts to/root
in the ISO image.sudo bash mkarchiso.sh
virt-install_arch.sh
will create a virtual machine using ISO files created bymkarchiso.sh
. It will not have graphics output, only serial output to terminal. This requires adding kernel parameterconsole=ttyS0
to ISO image.sudo bash virt-install_arch.sh vm_name
virsh_undefine.sh
will remove a virtual machine and its storage.sudo bash virsh_undefine.sh vm_name
I use these scripts to test my Arch Linux installation scripts.
-
fedora_post_install.sh
anddebian_post_install.sh
will configure OpenSSH server port and firewall. -
roles/
directory contains various Ansible roles. You could find documentation of each Ansible role under its directory.
- Boot into live ISO
- Download the
arch_install.sh
fileIf you want to use systemd-homed, also downloadcurl -LO https://raw.githubusercontent.com/Bai-Chiang/homelab_automation/main/arch_install.sh
homed.sh
curl -LO https://raw.githubusercontent.com/Bai-Chiang/homelab_automation/main/homed.sh
- Run the installation script
If using systemd-homed the installation script will only set up a root account, and create
bash arch_install.sh
/root/homed.sh
. You need to reboot into newly installed system and login as root, then runbash homed.sh
To run Ansible playbooks locally.
- Download necessary packages
pacman -S --needed git ansible
- Clone this repository
git clone https://github.com/Bai-Chiang/homelab_automation.git cd homelab_automation
- Edit
gui_example.yml
andhost_vars/gui_example.yml
. You may also checkheadless_example.yml
andhost_vars/headless_example.yml
. - Run ansible playbooks locally with
ansible-playbook gui_example.yml
Here is the brief introduction of all Ansible roles, detailed documentation of each Ansible role listed under its directory, including all Ansible variables and examples. All Ansible roles listed below are tested with Arch Linux. Some also tested with fedora or Debian.
archlinux_common
contains common/sane post-installation configuration for Arch Linux.auto-update
will auto-update your system and reboot if necessary. For Arch Linux it will send an email containspacman -Syu
log to the email address configured inroles/msmtp
.gui
related tasks, like installing GPU driver, PipeWire, desktop environment, Flatpak, restore dotfiles, and setup snapshot for your home directory.msmtp
configures a simple SMTP client, used to send email notification.nas
will edit fstab to mount extra disk and set up btrfs-scrub timer. It will send btrfs scrub result and S.M.A.R.T. notification to an email address configured withroles/msmtp
. It could also set up NFS ans Samba server.podman
rootless containers that I used in my homelab. These containers could run as different users.nut
(Network UPS Tools) will monitor UPS status and send email notification configured withroles/msmtp
.openssh
server limit allowed login user, only allow public key authentication, set up firewall rules.systemd_networkd
configuration, either single NIC with static IP or custom setup.wpa_supplicant
setup when using systemd-networkd as network manager. DOES NOT work with NetworkManager.libvirt
virtualization.