diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf2926d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vagrant/ +host_vars/ diff --git a/README.md b/README.md index eb665a4..e0c17c2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is an Ansible playbook to deploy system configurations for desktop usage. - Have a fresh installation of Alpine (after running `setup-alpine` and reboot) -- Install `ansible-core` and `git` +- Install `ansible` and `git` - Clone this repository @@ -23,13 +23,32 @@ This is an Ansible playbook to deploy system configurations for desktop usage. - Run the playbook: ```bash - ansible-playbook -i hosts setup.yml + ansible-playbook setup.yml ``` - Reboot and login as the newly created normal user - Proceed with [dotfiles-ansible](https://git.disroot.org/FollieHiyuki/dotfiles-ansible) playbook +## ✔️ Testing + +- You need to have [Vagrant](https://www.vagrantup.com/) installed, with [vagrant-libvirt](https://github.com/vagrant-libvirt/vagrant-libvirt) plugin. +- Run the playbook inside the VM: + +```bash +# Start the VM and ssh into it +vagrant up + +# ssh into the VM (requires OpenSSH) +# Alternatively run 'vagrant ssh-config' to get the machine IP address +# and manually ssh into it, e.g. 'dbclient -y vagrant@' +vagrant ssh + +# Run the playbook as root +cd /vagrant +sudo ansible-playbook -v setup.yml +``` + ## 🖊️ Notes - This playbook assumes that the person running it is me 😃. It might do specific tasks that you don't like. Use with your own risks. diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..1c7c72c --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,26 @@ +$provision_script = <<-SCRIPT +rc-service openntpd stop && rc-update del openntpd && apk del openntpd +apk add ansible grub +mkdir -pv /vagrant/host_vars +echo \"vault_password: \'123456\'\" > /vagrant/host_vars/localhost.yml +SCRIPT + +Vagrant.configure("2") do |config| + config.vm.define :sysconfig do |sysconfig| + sysconfig.vm.box = "generic/alpine315" + + sysconfig.vm.provider :libvirt do |libvirt| + libvirt.cpus = 2 + libvirt.memory = 512 + + # Use the default NAT network of libvirt + libvirt.management_network_name = "default" + libvirt.management_network_address = "192.168.122.0/24" + end + + sysconfig.vm.provision "shell", inline: $provision_script + end + + config.vm.synced_folder ".", "/vagrant", type: "rsync", + rsync__exclude: [".git/", "Vagrantfile", ".gitignore"] +end diff --git a/group_vars/all.yml b/group_vars/all.yml index 42ffc75..2fb3eb7 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -35,7 +35,6 @@ libvirt_daemons: password: '{{ vault_password }}' - # Do NOT change these variables ─────────────────────────────────────────────── # elogind needs polkit to function diff --git a/roles/essential/files/bluetooth_blacklist.conf b/roles/essential/files/bluetooth-blacklist.conf similarity index 100% rename from roles/essential/files/bluetooth_blacklist.conf rename to roles/essential/files/bluetooth-blacklist.conf diff --git a/roles/essential/tasks/main.yml b/roles/essential/tasks/main.yml index 11baf6d..3031fe2 100644 --- a/roles/essential/tasks/main.yml +++ b/roles/essential/tasks/main.yml @@ -7,14 +7,18 @@ group: root mode: 0644 +- name: essential | Upgrade the system + apk: + available: yes + upgrade: yes + update_cache: yes + - name: essential | Install common dependencies apk: name: >- doas, nftables, zstd, fish, dbus, terminus-font, apparmor-profiles, apparmor, openresolv, libvirt-daemon, qemu-img, qemu-system-x86_64, - qemu-modules, shadow-login, unbound, dns-root-hints - available: yes - update_cache: yes + qemu-modules, shadow-login, unbound, dns-root-hints, eudev state: present - name: essential | Start services on runlevel 'default' diff --git a/roles/grub/tasks/main.yml b/roles/grub/tasks/main.yml index edbec95..e831f87 100644 --- a/roles/grub/tasks/main.yml +++ b/roles/grub/tasks/main.yml @@ -7,6 +7,14 @@ group: root mode: 0644 +- name: grub | Ensure fonts directory exists + file: + path: /boot/grub/fonts + state: directory + owner: root + group: root + mode: 0755 + # Download a release from https://github.com/source-foundry/Hack # Decompress the archive # Run: grub-mkfont -o hack.pf2 -s 24 Hack-Regular.ttf