Add Vagrantfile for testing
Also fix some edge cases when testing
This commit is contained in:
parent
55fcacf5a0
commit
9796d5beb0
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.vagrant/
|
||||||
|
host_vars/
|
23
README.md
23
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)
|
- Have a fresh installation of Alpine (after running `setup-alpine` and reboot)
|
||||||
|
|
||||||
- Install `ansible-core` and `git`
|
- Install `ansible` and `git`
|
||||||
|
|
||||||
- Clone this repository
|
- Clone this repository
|
||||||
|
|
||||||
|
@ -23,13 +23,32 @@ This is an Ansible playbook to deploy system configurations for desktop usage.
|
||||||
- Run the playbook:
|
- Run the playbook:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ansible-playbook -i hosts setup.yml
|
ansible-playbook setup.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
- Reboot and login as the newly created normal user
|
- Reboot and login as the newly created normal user
|
||||||
|
|
||||||
- Proceed with [dotfiles-ansible](https://git.disroot.org/FollieHiyuki/dotfiles-ansible) playbook
|
- 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@<ip_address>'
|
||||||
|
vagrant ssh
|
||||||
|
|
||||||
|
# Run the playbook as root
|
||||||
|
cd /vagrant
|
||||||
|
sudo ansible-playbook -v setup.yml
|
||||||
|
```
|
||||||
|
|
||||||
## 🖊️ Notes
|
## 🖊️ 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.
|
- 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.
|
||||||
|
|
26
Vagrantfile
vendored
Normal file
26
Vagrantfile
vendored
Normal file
|
@ -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
|
|
@ -35,7 +35,6 @@ libvirt_daemons:
|
||||||
|
|
||||||
password: '{{ vault_password }}'
|
password: '{{ vault_password }}'
|
||||||
|
|
||||||
|
|
||||||
# Do NOT change these variables ───────────────────────────────────────────────
|
# Do NOT change these variables ───────────────────────────────────────────────
|
||||||
|
|
||||||
# elogind needs polkit to function
|
# elogind needs polkit to function
|
||||||
|
|
|
@ -7,14 +7,18 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
|
- name: essential | Upgrade the system
|
||||||
|
apk:
|
||||||
|
available: yes
|
||||||
|
upgrade: yes
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
- name: essential | Install common dependencies
|
- name: essential | Install common dependencies
|
||||||
apk:
|
apk:
|
||||||
name: >-
|
name: >-
|
||||||
doas, nftables, zstd, fish, dbus, terminus-font, apparmor-profiles,
|
doas, nftables, zstd, fish, dbus, terminus-font, apparmor-profiles,
|
||||||
apparmor, openresolv, libvirt-daemon, qemu-img, qemu-system-x86_64,
|
apparmor, openresolv, libvirt-daemon, qemu-img, qemu-system-x86_64,
|
||||||
qemu-modules, shadow-login, unbound, dns-root-hints
|
qemu-modules, shadow-login, unbound, dns-root-hints, eudev
|
||||||
available: yes
|
|
||||||
update_cache: yes
|
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: essential | Start services on runlevel 'default'
|
- name: essential | Start services on runlevel 'default'
|
||||||
|
|
|
@ -7,6 +7,14 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
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
|
# Download a release from https://github.com/source-foundry/Hack
|
||||||
# Decompress the archive
|
# Decompress the archive
|
||||||
# Run: grub-mkfont -o hack.pf2 -s 24 Hack-Regular.ttf
|
# Run: grub-mkfont -o hack.pf2 -s 24 Hack-Regular.ttf
|
||||||
|
|
Reference in a new issue