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.shscript 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_commonandroles/gui. -
arch_install_bcachefs.shscript 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_commonandroles/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.shwill create a latest Arch Linux ISO under/tmpdirectory with optionally additional kernel parameters. It will also copy installation scripts to/rootin the ISO image.sudo bash mkarchiso.shvirt-install_arch.shwill 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=ttyS0to ISO image.sudo bash virt-install_arch.sh vm_namevirsh_undefine.shwill remove a virtual machine and its storage.sudo bash virsh_undefine.sh vm_nameI use these scripts to test my Arch Linux installation scripts.
-
fedora_post_install.shanddebian_post_install.shwill 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.shfileIf you want to use systemd-homed, also downloadcurl -LO https://raw.githubusercontent.com/Bai-Chiang/homelab_automation/main/arch_install.shhomed.shcurl -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.ymlandhost_vars/gui_example.yml. You may also checkheadless_example.ymlandhost_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_commoncontains common/sane post-installation configuration for Arch Linux.auto-updatewill auto-update your system and reboot if necessary. For Arch Linux it will send an email containspacman -Syulog to the email address configured inroles/msmtp.guirelated tasks, like installing GPU driver, PipeWire, desktop environment, Flatpak, restore dotfiles, and setup snapshot for your home directory.msmtpconfigures a simple SMTP client, used to send email notification.naswill 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.podmanrootless 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.opensshserver limit allowed login user, only allow public key authentication, set up firewall rules.systemd_networkdconfiguration, either single NIC with static IP or custom setup.wpa_supplicantsetup when using systemd-networkd as network manager. DOES NOT work with NetworkManager.libvirtvirtualization.