Compare commits

...

5 Commits

Author SHA1 Message Date
f34dd35d5c
Update homelab package list reference 2023-07-11 03:16:43 -04:00
e21eb854d7
Set options for fragile GUI automation 2023-07-11 03:13:43 -04:00
d9608d2d1b
Install provisioning tools in the VM
- Added --diff flag
- Installed virt-manager and ansible
- Removed duplicate software install task
- Removed irrelevant GUI task
2023-07-11 02:28:23 -04:00
f68117d9a0
Enhanced variable handling
- Load variables from .vagrant_settings
- Provide default values
2023-06-13 02:04:30 -04:00
b3e232451c
Upgrade to Debian 12, with minor updates
- Upgraded project to Debian 12
- .vscode added to .gitignore
- LICENSE formatting updated
- Copyright refreshed for 2023
- Added Libvirt settings
- Refactored packages to inventory-specific
- Committed missing autostart-scripts
2023-06-13 01:04:39 -04:00
11 changed files with 131 additions and 48 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
.vagrant
.vagrant_settings
.vscode

13
LICENSE
View File

@ -1,5 +1,12 @@
Copyright (C) 2021 by Kris Lamoureux <kris@lamoureux.io>
Copyright (C) 2021, 2023 by Kris Lamoureux <kris@lamoureux.io>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -4,6 +4,6 @@ An Ansible project for provisioning and managing a Debian GNU/Linux productivity
- The vagrant user's password is: `password`
#### Copyrights and Licenses
Copyright 2021 Kris Lamoureux
Copyright 2021, 2023 Kris Lamoureux
This project is licensed under the 0BSD license, a public-domain-equivalent license. Please refer to the LICENSE file contained in the repository.

35
Vagrantfile vendored
View File

@ -1,15 +1,43 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Load overrides
require 'yaml'
settings_path = '.vagrant_settings'
settings = {}
if File.exist?(settings_path)
settings = YAML.load_file(settings_path)
end
VAGRANT_CPUS = settings["VAGRANT_CPUS"] || 2
VAGRANT_MEMORY = settings["VAGRANT_MEMORY"] || 4096
VAGRANT_NETWORK_NAME = settings["VAGRANT_NETWORK_NAME"] || "vagrant-libvirt"
VAGRANT_NETWORK_ADDR = settings["VAGRANT_NETWORK_ADDR"] || "192.168.121.0/24"
# Vagrant
Vagrant.configure("2") do |config|
config.vm.box = "debian/bullseye64"
config.vm.box = "debian/bookworm64"
config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", disabled: true
# Libvirt settings
config.vm.provider :libvirt do |libvirt|
libvirt.cpu_mode = "host-model"
libvirt.cpus = VAGRANT_CPUS
libvirt.memory = VAGRANT_MEMORY
libvirt.management_network_name = VAGRANT_NETWORK_NAME
libvirt.management_network_address = VAGRANT_NETWORK_ADDR
libvirt.nested = true
end
# Boot with a GUI in VirtualBox
config.vm.provider "virtualbox" do |vbox|
vbox.customize ["modifyvm", :id, "--vram", "128",
"--graphicscontroller", "vboxvga",
"--accelerate3d", "on"]
vbox.memory = 4096
vbox.cpus = 2
vbox.memory = VAGRANT_MEMORY
vbox.cpus = VAGRANT_CPUS
vbox.gui = true
end
@ -18,5 +46,6 @@ Vagrant.configure("2") do |config|
ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles"
ansible.compatibility_mode = "2.0"
ansible.playbook = "site-vagrant.yml"
ansible.raw_arguments = ["--diff"]
end
end

View File

@ -1,11 +1,35 @@
# Settings convenient for development in vagrant
development: true
packages:
# GUI applications
- firefox-esr
- terminator
- remmina
# Virtualization
- qemu-system
- libvirt-daemon-system
- vagrant-libvirt
- virt-manager
# Configuration management
- ansible
users:
- name: vagrant
groups:
- libvirt
favorites:
- firefox-esr.desktop
- terminator.desktop
- org.kde.dolphin.desktop
- org.remmina.Remmina.desktop
#manage_gui: true
#darkmode: true
#favorites:
# - firefox-esr.desktop
# - terminator.desktop
# - org.kde.dolphin.desktop
# - org.remmina.Remmina.desktop
#pinned:
# - firefox-esr.desktop
# - terminator.desktop

View File

@ -1,8 +1,10 @@
darkmode: false
homedir: "/home/{{ item.name }}"
# Follows homelab package list:
# https://github.com/krislamo/moxie/blob/master/roles/base/defaults/main.yml
moxie_packages:
# https://git.krislamo.org/kris/homelab/src/branch/main/roles/base/defaults/main.yml#L6
homelab_packages:
- apache2-utils
- cryptsetup
- curl
- dnsutils
@ -18,9 +20,6 @@ moxie_packages:
- vim
- wget
manage_gui: false
packages:
- "{{ moxie_packages }}"
- firefox-esr
- meld
- remmina
- terminator
- "{{ homelab_packages }}"

View File

@ -1,24 +1,6 @@
- name: Set vagrant user password
user:
ansible.builtin.user:
name: vagrant
password: "$6$xu0I8bbf.Nva7uCo$OHz5/64u0SjHa1jn0EwCLSNw7Zoj5ejhL\
6NtaXYY6zlC0CQa0J4kZIxAp2Ls4lMdLmuo7oMQX/vlDucR9BbcA."
- name: Install fasttrack archive keyring
apt:
name: fasttrack-archive-keyring
state: present
update_cache: true
- name: Enable fasttrack
copy:
dest: /etc/apt/sources.list.d/fasttrack.list
content: |
deb https://fasttrack.debian.net/debian-fasttrack/ bullseye-fasttrack main contrib
deb https://fasttrack.debian.net/debian-fasttrack/ bullseye-backports-staging main contrib
- name: Install guest additions
apt:
name: virtualbox-guest-x11
state: present
update_cache: true

View File

@ -1,5 +1,5 @@
- name: Install KDE
apt:
ansible.builtin.apt:
name: kde-standard
state: present
update_cache: true
@ -11,6 +11,7 @@
owner: "{{ item.name }}"
group: "{{ item.name }}"
loop: "{{ users }}"
when: manage_gui
- name: Enable KDE dark theme
copy:
@ -22,20 +23,26 @@
lookandfeeltool -a $(lookandfeeltool --list | grep dark)
fi
loop: "{{ users }}"
- name: Install packages
apt:
name: "{{ item }}"
loop: "{{ packages }}"
when: manage_gui and darkmode
- name: Install sqlite3
apt:
ansible.builtin.apt:
name: sqlite3
state: present
when: manage_gui and favorites is defined or pinned is defined
- name: Change favorites menu
template:
ansible.builtin.template:
src: favorites.sh.j2
dest: "{{ homedir }}/.config/autostart-scripts/favorites.sh"
mode: a+x
loop: "{{ users }}"
when: manage_gui and favorites is defined
- name: Change task manager pinned apps
ansible.builtin.template:
src: pinnedapps.sh.j2
dest: "{{ homedir }}/.config/autostart-scripts/pinnedapps.sh"
mode: a+x
loop: "{{ users }}"
when: manage_gui and pinned is defined

View File

@ -1,6 +1,12 @@
- import_tasks: development.yml
- name: Import development vagrant tasks
ansible.builtin.import_tasks: development.yml
tags: development
when: development
- import_tasks: gui.yml
- name: Import system tasks
ansible.builtin.import_tasks: system.yml
tags: system
- name: Import GUI tasks
ansible.builtin.import_tasks: gui.yml
tags: gui

View File

@ -0,0 +1,16 @@
- name: Install software
ansible.builtin.apt:
name: "{{ packages }}"
state: present
update_cache: true
- name: Create system users
ansible.builtin.user:
name: "{{ item.name }}"
state: present
groups: "{{ item.groups }}"
append: yes
shell: "{{ item.shell | default('/bin/bash') }}"
create_home: "{{ item.home | default(false) }}"
loop: "{{ users }}"
when: users is defined

View File

@ -0,0 +1,11 @@
#!/bin/bash
PINNED="{% for item in pinned %}{{ item }}{{ ',' if not loop.last else '' }}{% endfor %}"
FILE="~/.config/plasma-org.kde.plasma.desktop-appletsrc"
HEADER="[Containments][2][Applets][5][Configuration][General]"
SECTIONUNDER="[Containments][2][Applets][6]"
if [ -f "$FILE" ]; then
if ! grep -q "$PINNED" "$FILE"; then
sed -i "/^$HEADER\nlaunchers=.*/i\n\n$SECTIONUNDER" "$FILE"
fi
fi