GithubHelp home page GithubHelp logo

iac's Introduction

iac

Infrastructure as Code.

This project installs and configures Arch Linux, Debian or Ubuntu operating systems fully automated.

โš  Make sure to create a .env file and reference to the correct code branch with the env vars in it!

Features:

  • ๐Ÿ’ฟ Build the installer ISO image in a Docker environment
  • ๐Ÿ’ก Read hostname and OS type from UEFI variables or use cloud-init
  • ๐Ÿ”จ Install a minimal Arch Linux OS, Debian OS or Ubuntu OS
  • โ“ Decide target disk for installation, etc by hostname
  • ๐Ÿ” Setup root password, SSH keys and user accounts
  • ๐Ÿš€ Autostart OS configuration at first boot
  • ๐Ÿ’ป Autostart Desktop configuration at first Desktop logon
  • โฑ From blank disk to booted system in ~10 Minutes

Workflow base installation & hostname based configuration:

graph LR
    build["Build<br>ISO"] --> boot["Boot<br>ISO"]
    boot --> bootstrap["Run<br>bootstrap"]
    bootstrap --> reboot1["Reboot into<br>new OS"]
    autorun1["Autorun host<br>playbook on<br>first boot<br>(Install OS components)"]
    autorun1 --> reboot2["Reboot"]
    reboot2 --> xfce["Boot into<br>XFCE4"]
    xfce --> autorun2["Run host<br>playbook on<br>first XFCE Login<br>(Configure XFCE4)"]
    autorun2 --> logout["Logout<br>to load<br>XFCE settings"]
    logout --> done["Done!"]

Architecture

All packages are installed from the official sources.

  • bash
  • systemd
  • systemd-networkd (DHCP on all ens* interfaces)
  • systemd-timesyncd
  • systemd-resolved
  • net-tools + dnsutils
  • nano + vim
  • curl + wget
  • Ansible
OS #Packages #Processes Size Memory
Ubuntu 24.04 "Noble" ~390 14 2.5GB 280MB
Debian 12 "Bookworm" ~390 14 2.2GB 270MB
Arch Linux ~170 20 2.7GB 300MB

archiso

Archiso is used as a base for the Installer ISO. archiso/ contains a Dockerfile and some scripts to build a custom Arch Linux installer ISO with additional scripts.

  • ./archiso/build.sh builds the container image
  • ./archiso/pack.sh runs the container image to build the Arch Linux ISO image
  • ISO Image can be found in ./archiso/output/

Requires Docker CE, pack.sh executes a container in privileged mode.

Automatic configuration with Cloud-Init

TODO

Automatic hostname detection with UEFI varables

The perrys-bootstrapper.sh script is using UEFI variables to fetch the hostname from the system and use the correct ansible inventory variables.

Set hostname in UEFI variable:

echo -n myhostname > efi-hostname
efivar --name ed38a5bf-1135-4b0f-aa72-49d30b05dfd4-PerryHostname -w -f efi-hostname

Get the hostname from UEFI variable:

cat /sys/firmware/efi/efivars/PerryHostname-ed38a5bf-1135-4b0f-aa72-49d30b05dfd4

In addition the variable PerryFlavor-ed38a5bf-1135-4b0f-aa72-49d30b05dfd4 can be used to set the flavor (debian or archlinux).

How to install a OS

  • Build the Arch Linux ISO image
  • Boot ISO in a virtual machine or on a physical system
  • Ensure that the diskdev and bootmode are correct in the inventoy
  • Run installer
    • Debian: perrys-bootstrapper.sh --flavor debian
    • Arch Linux: perrys-bootstrapper.sh --flavor archlinux
  • Reboot into the new OS

Configure Arch Linux OS

Run perrys-ansible-apply.sh as root.

It pulls automatically the correct playbook from this repo by the hostname of the operating system.

TODO

  • Bluetooth
  • NetworkManager
  • NFTables
  • Pulseaudio
  • Swap File
  • Unix Account
  • X11
  • XFCE
  • Self-Signed certificate for localhost
  • NGINX with tilde user dirs
  • SSH Daemon config
  • Disk Encryption

iac's People

Contributors

perryflynn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.