{"id":13495957,"url":"https://github.com/antoinemartin/archlinux-ansible-install","last_synced_at":"2026-03-04T13:32:23.509Z","repository":{"id":137155193,"uuid":"327342978","full_name":"antoinemartin/archlinux-ansible-install","owner":"antoinemartin","description":"Arch Linux basic installation through Ansible","archived":false,"fork":false,"pushed_at":"2021-04-24T09:53:59.000Z","size":23,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T16:40:33.167Z","etag":null,"topics":["ansible","ansible-role","archlinux"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoinemartin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-01-06T14:52:57.000Z","updated_at":"2025-05-25T14:04:33.000Z","dependencies_parsed_at":"2024-01-16T09:54:04.596Z","dependency_job_id":"9975a402-5334-4d30-97a8-4756af25ad16","html_url":"https://github.com/antoinemartin/archlinux-ansible-install","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/antoinemartin/archlinux-ansible-install","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinemartin%2Farchlinux-ansible-install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinemartin%2Farchlinux-ansible-install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinemartin%2Farchlinux-ansible-install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinemartin%2Farchlinux-ansible-install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoinemartin","download_url":"https://codeload.github.com/antoinemartin/archlinux-ansible-install/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinemartin%2Farchlinux-ansible-install/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30081439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T13:22:36.021Z","status":"ssl_error","status_checked_at":"2026-03-04T13:20:45.750Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","archlinux"],"created_at":"2024-07-31T19:01:40.102Z","updated_at":"2026-03-04T13:32:23.487Z","avatar_url":"https://github.com/antoinemartin.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Arch Linux installation via Ansible\n\nThis project implements with [Ansible](https://docs.ansible.com/ansible/latest/index.html)\nthe automated basic Arch Linux installation described in the\n[Arch Linux Wiki](https://wiki.archlinux.org/index.php/installation_guide).\n\nThe installation is performed from another machine on the same local network.\n\nThe installation involves the following steps:\n\n1. Boot the machine to be installed with the [Arch Linux ISO](https://archlinux.org/download/).\n   The machine connects to the local network.\n2. Start a sshd server and allow ssh root remote connections with a ssh key\n   configured on a github account. This is done by executing a shell script\n   downloaded from this repository.\n3. From an installation machine on which this project has been cloned, perform\n   the installation.\n4. Reboot the machine.\n\n## Default configuration\n\nUpon installation, the installed machine only contains a basic installation with\na sshd server and a bastion user account (`arch` by default).\n\nBy default, the installed machine has the following features (look\n[below](#customization) for customization):\n\n- A Bios boot partition of 1 MByte.\n- An UEFI partition of 300 Mbytes.\n- A Swap partition of 1 Gbyte.\n- An ext4 root partition covering the rest of the installation volume.\n- The hostname is `arch`.\n- The unique user is named `arch`.\n- The unique user has no password.\n- The unique user is sudoer without password.\n- The network is configured on `eth0` with DCHP via\n  [systemd-networkd](https://wiki.archlinux.org/index.php/systemd-networkd).\n\n- Time is synchronized with [systemd-timesyncd](https://wiki.archlinux.org/index.php/Systemd-timesyncd)\n- Name resolution is done through [systemd-resolved](https://wiki.archlinux.org/index.php/Systemd-resolved)\n- A sshd server is launched at boot.\n- The bootloader is grub and works either on BIOS and on UEFI. UEFI installation\n  is only performed if the installation medium has been booted in uefi mode.\n\n## Pre-requisisites\n\nThis project assumes that the machine to be installed is connected to the local\nnetwork on the first wired interface (`eth0`).\n\nThe installation is performed from another machine connected to the same\nnetwork. Clone this project on this machine and install ansible with the\nfollowing:\n\n```console\n\u003e git clone https://github.com/antoinemartin/archlinux-ansible-install.git\n\u003e cd archlinux-ansible-install\n\u003e python3 -mvenv env\n\u003e source env/bin/activate\n(env) \u003e pip install ansible\n(env) \u003e _\n```\n\nOn archlinux you may want to use the ansible package:\n\n```console\n\u003e sudo pacman -S ansible\n```\n\n## Installation instructions\n\nPerform the [Pre-installation](https://wiki.archlinux.org/index.php/installation_guide#Pre-installation)\ninstructions of the Archlinux install guide up to [Connect to the internet](https://wiki.archlinux.org/index.php/installation_guide#Connect_to_the_internet)\nthat involves:\n\n- [Download](https://archlinux.org/download/) the installation image.\n- Prepare the installation medium either on [USB or SD Card](https://wiki.archlinux.org/index.php/USB_flash_installation_medium)\n  or [PXE](https://wiki.archlinux.org/index.php/Preboot_Execution_Environment)\n- Boot the machine on the ISO.\n\nOn the login prompt, the first thing you may want to do is set the keyboard:\n\n```console\nroot@archiso ~ # loadkeys fr\nroot@archiso ~ # _\n```\n\nAnd check your network connection:\n\n```console\nroot@archiso ~ # ip route get 1\n1.0.0.0 192.168.0.1 dev ens33 src 192.168.0.238 uid 0\nroot@archiso ~ # _\n```\n\nBefore performing the installation from the development machine you need to:\n\n- Start the ssh server,\n- Allow remote connections with some ssh key.\n\nThe [archinstall_seed.sh](archinstall_seed.sh) script on this project does this.\nIt takes the ssh public key from a github account.\nYou can specify your own account by setting the\n`ARCHINSTALL_SSH_KEY_GITHUB_ACCOUNT` variable before running the script:\n\n```console\nroot@archiso ~ # export ARCHINSTALL_SSH_KEY_GITHUB_ACCOUNT=antoinemartin\nroot@archiso ~ # source \u003c(curl -Ls https://raw.githubusercontent.com/antoinemartin/archlinux-ansible-install/archinstall_seed.sh)\nInstalling ssh key\nStarting ssh...\n\nNow you can connect with ssh root@192.168.0.238\n\nTo install this machine, on your development machine do the following:\n\n$ export ARCHINSTALL_SSH_KEY_GITHUB_ACCOUNT=antoinemartin\n$ export ARCHINSTALL_IP_ADDRESS=192.168.0.238\n$ export ARCHINSTALL_SSH_KEY=$HOME/.ssh/antoinemartin.key # (Optional. Or ssh-add key)\n$ export ARCHINSTALL_HOSTNAME=...        # (Optional. arch by default)\n$ export ARCHINSTALL_USERNAME=...        # (Optional. arch by default)\n$ export ARCHINSTALL_PASSWORD=...        # (Optional. No password by default)\n$ ansible-playbook install_archlinux.yaml\n\nIf you want to restart from scratch, run the following commands here before:\n\n$ wipefs --all /dev/sda\n$ sfdisk --delete all /dev/sda\n\nroot@archiso ~ # _\n```\n\nCheck the ssh connection from your development machine:\n\n```console\n$ ssh -i ~/.ssh/antoinematin.dsa root@192.168.0.238\nTo install Arch Linux follow the installation guide:\nhttps://wiki.archlinux.org/index.php/Installation_guide\n\nFor Wi-Fi, authenticate to the wireless network using the iwctl utility.\nEthernet and Wi-Fi connections using DHCP should work automatically.\n\nAfter connecting to the internet, the installation guide can be accessed\nvia the convenience script Installation_guide.\n\nLast login: Sun Jan  3 11:26:42 2021 from 192.168.0.64\nroot@archiso ~ # exit\n$ _\n```\n\nYou can then perform the installation:\n\n```console\n$ export ARCHINSTALL_SSH_KEY_GITHUB_ACCOUNT=antoinemartin\n$ export ARCHINSTALL_IP_ADDRESS=192.168.0.238\n$ export ARCHINSTALL_SSH_KEY=$HOME/.ssh/antoinemartin.dsa\n$ ansible-playbook install_archlinux.yaml\n...\n```\n\nThe installation will be performed. Upon completion, you can restart the machine\nand connect to it via ssh:\n\n```console\n$ ssh -i ~/.ssh/antoinemartin.dsa arch@arch\nWarning: Permanently added 'arch,192.168.0.61' (ECDSA) to the list of known hosts.\nLast login: Sun Jan  3 13:04:16 2021 from 192.168.0.64\narch@arch:~ \u003e\n```\n\n## Customization\n\nCustomization is described in [the role README\nfile](roles/system_archlinux_install/README.md).\n\nThe following elements can be configured:\n\n- The presence of a swap partition (`-e has_swap=yes`).\n- The host name of the machine (`arch` by default).\n- The entry user name (`arch` by default).\n- The password for the user. By default, the user has no password and the login\n  can only be performed through ssh.\n- The bootloader. It can either be [GRUB](https://wiki.archlinux.org/index.php/GRUB)\n  or [Systemd-boot](https://wiki.archlinux.org/index.php/systemd-boot). The\n  later doesn't need a specific package installation and is the default. The\n  former offers much more options (BIOS **and** UEFI).\n- The presence of a swap file.\n\n## Development\n\nThis is a small Ansible project containing:\n\n- a one machine inventory in the [inventory](inventory) file.\n- a role named `system_archlinux_install` performing the intallation. This role\n  is contained in the `roles` directory.\n- A playbook in the file [install_archlinux.yaml](install_archlinux.yaml) performing the role on the `archlinux` host.\n- A simple [ansible.cfg](ansible.cfg) Ansible configuration.\n\nDevelopment and adapation of the role can be done on a Virtual Machine. It has\nbeen successfully tested on VMware and xhyve, but the most portable\nvirtualization solution is probably [qemu](https://qemu.org).\n\nYou can create a _test disk_ with the following command:\n\n```console\n❯ qemu-img create -f raw arch.img 10G\n```\n\nTo launch a virtual machine in UEFI, you need an UEFI firmware. You can grab an\nalready compiled version for instance [here](https://github.com/clearlinux/common/blob/master/OVMF.fd).\n\nAnd then launch the test virtual machine with:\n\n```console\n\u003e qemu-system-x86_64 \\\n   -vga virtio \\\n   -machine type=q35,accel=hvf \\\n   -m 1024 \\\n   -device virtio-net-pci,netdev=net0 \\\n   -netdev 'user,id=net0,hostfwd=tcp::5555-:22,guestfwd=tcp:10.0.2.100:80-cmd:nc localhost 8000' \\\n   -hda arch.img \\\n   -bios OVMF.fd \\\n   -cdrom ./archlinux-2021.01.01-x86_64.iso\n```\n\nThe `guestfwd=tcp:10.0.2.100:80-cmd:nc localhost 8000` allows you to fetch the\n`archinstall_seed.sh` locally by running on your development server:\n\n```console\n\u003e python3 -mhttp.server\n```\n\nAnd on the virtual machine:\n\n```console\nroot@archiso ~ # /bin/bash -c \"$(curl -Ls http://10.0.2.100/archinstall_seed.sh)\nInstalling ssh key\nStarting ssh...\n\nNow you can connect with ssh root@10.0.2.15\n\nTo install this machine, on your development machine do the following:\n\n$ export ARCHINSTALL_SSH_KEY_GITHUB_ACCOUNT=antoinemartin\n$ export ARCHINSTALL_IP_ADDRESS=10.0.2.15\n$ export ARCHINSTALL_SSH_KEY=$HOME/.ssh/antoinemartin.key # (Optional. Or ssh-add key)\n$ export ARCHINSTALL_HOSTNAME=...        # (Optional. arch by default)\n$ export ARCHINSTALL_USERNAME=...        # (Optional. arch by default)\n$ export ARCHINSTALL_PASSWORD=...        # (Optional. No password by default)\n$ ansible-playbook install_archlinux.yaml\n\nIf you want to restart from scratch, run the following commands here before:\n\n$ wipefs --all /dev/sda\n$ sfdisk --delete all /dev/sda\n\nroot@archiso ~ # _\n```\n\nNow you can perform the installation with:\n\n```console\n\u003e # On the host\n\u003e export ARCHINSTALL_IP_ADDRESS=127.0.0.1\n\u003e export ARCHINSTALL_SSH_PORT=5555\n\u003e ansible-playbook install_archlinux.yaml\n```\n\nReboot the virtual machine without the CD ROM:\n\n```console\n\u003e qemu-system-x86_64 \\\n   -vga virtio \\\n   -machine type=q35,accel=hvf \\\n   -m 1024 \\\n   -device virtio-net-pci,netdev=net0 \\\n   -netdev user,id=net0,hostfwd=tcp::5555-:22 \\\n   -hda arch.img \\\n   -bios OVMF.fd\n```\n\nOnce booted, you can connect through the forwarded port:\n\n```console\n❯ ssh -i ~/.ssh/antoinemartin.dsa -p 5555 arch@localhost\nWarning: Permanently added '[localhost]:5555' (ECDSA) to the list of known hosts.\nLast login: Wed Jan  6 15:38:56 2021 from 10.0.2.2\narch@arch:~ \u003e _\n```\n\nAnd you can also reboot without the `-bios` option to test in BIOS mode:\n\n```console\n\u003e qemu-system-x86_64 \\\n   -vga virtio \\\n   -machine type=q35,accel=hvf \\\n   -m 1024 \\\n   -device virtio-net-pci,netdev=net0 \\\n   -netdev user,id=net0,hostfwd=tcp::5555-:22 \\\n   -hda arch.img\n```\n\n## Alternatives\n\nFor virtual machines,\n[packer-arch](https://github.com/elasticdog/packer-arch) provides a similar\nconfiguration.\n\nFor laptop and desktop computers, [spark](https://github.com/pigmonkey/spark) and \n[ansible-arch](https://github.com/lgaggini/ansible-arch) provide more installation\noptions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoinemartin%2Farchlinux-ansible-install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoinemartin%2Farchlinux-ansible-install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoinemartin%2Farchlinux-ansible-install/lists"}