Compare commits

..

7 Commits

Author SHA1 Message Date
58e2f5f850 Add a way to exclude custom inventory 2023-07-18 01:37:58 -04:00
8e28830c16 Slight reorganization for development 2023-07-18 01:29:21 -04:00
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
14 changed files with 149 additions and 58 deletions

4
.gitignore vendored
View File

@@ -1 +1,5 @@
environments
inventories
.vagrant .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` - The vagrant user's password is: `password`
#### Copyrights and Licenses #### 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. This project is licensed under the 0BSD license, a public-domain-equivalent license. Please refer to the LICENSE file contained in the repository.

37
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| Vagrant.configure("2") do |config|
config.vm.box = "debian/bullseye64" config.vm.box = "debian/bookworm64"
config.vm.network "private_network", type: "dhcp" config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", disabled: true 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 # Boot with a GUI in VirtualBox
config.vm.provider "virtualbox" do |vbox| config.vm.provider "virtualbox" do |vbox|
vbox.customize ["modifyvm", :id, "--vram", "128", vbox.customize ["modifyvm", :id, "--vram", "128",
"--graphicscontroller", "vboxvga", "--graphicscontroller", "vboxvga",
"--accelerate3d", "on"] "--accelerate3d", "on"]
vbox.memory = 4096 vbox.memory = VAGRANT_MEMORY
vbox.cpus = 2 vbox.cpus = VAGRANT_CPUS
vbox.gui = true vbox.gui = true
end end
@@ -17,6 +45,7 @@ Vagrant.configure("2") do |config|
config.vm.provision "ansible" do |ansible| config.vm.provision "ansible" do |ansible|
ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles" ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles"
ansible.compatibility_mode = "2.0" ansible.compatibility_mode = "2.0"
ansible.playbook = "site-vagrant.yml" ansible.playbook = "dev/workstation.yml"
ansible.raw_arguments = ["--diff"]
end end
end end

35
dev/inventory.yml Normal file
View File

@@ -0,0 +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
#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,11 +0,0 @@
# Settings convenient for development in vagrant
development: true
users:
- name: vagrant
favorites:
- firefox-esr.desktop
- terminator.desktop
- org.kde.dolphin.desktop
- org.remmina.Remmina.desktop

View File

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

View File

@@ -1,24 +1,5 @@
- name: Set vagrant user password - name: Set vagrant user password
user: ansible.builtin.user:
name: vagrant name: vagrant
password: "$6$xu0I8bbf.Nva7uCo$OHz5/64u0SjHa1jn0EwCLSNw7Zoj5ejhL\ password: "$6$xu0I8bbf.Nva7uCo$OHz5/64u0SjHa1jn0EwCLSNw7Zoj5ejhL\
6NtaXYY6zlC0CQa0J4kZIxAp2Ls4lMdLmuo7oMQX/vlDucR9BbcA." 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,19 +1,21 @@
- name: Install KDE - name: Install KDE
apt: ansible.builtin.apt:
name: kde-standard name: kde-standard
state: present state: present
update_cache: true update_cache: true
- name: Create autostart-scripts directory - name: Create autostart-scripts directory
file: ansible.builtin.file:
path: "{{ homedir }}/.config/autostart-scripts/" path: "{{ homedir }}/.config/autostart-scripts/"
state: directory state: directory
owner: "{{ item.name }}" owner: "{{ item.name }}"
group: "{{ item.name }}" group: "{{ item.name }}"
mode: 0700
loop: "{{ users }}" loop: "{{ users }}"
when: manage_gui
- name: Enable KDE dark theme - name: Enable KDE dark theme
copy: ansible.builtin.copy:
dest: "{{ homedir }}/.config/autostart-scripts/darkmode.sh" dest: "{{ homedir }}/.config/autostart-scripts/darkmode.sh"
mode: a+x mode: a+x
content: | content: |
@@ -22,20 +24,26 @@
lookandfeeltool -a $(lookandfeeltool --list | grep dark) lookandfeeltool -a $(lookandfeeltool --list | grep dark)
fi fi
loop: "{{ users }}" loop: "{{ users }}"
when: manage_gui and darkmode
- name: Install packages
apt:
name: "{{ item }}"
loop: "{{ packages }}"
- name: Install sqlite3 - name: Install sqlite3
apt: ansible.builtin.apt:
name: sqlite3 name: sqlite3
state: present state: present
when: manage_gui and favorites is defined or pinned is defined
- name: Change favorites menu - name: Change favorites menu
template: ansible.builtin.template:
src: favorites.sh.j2 src: favorites.sh.j2
dest: "{{ homedir }}/.config/autostart-scripts/favorites.sh" dest: "{{ homedir }}/.config/autostart-scripts/favorites.sh"
mode: a+x mode: a+x
loop: "{{ users }}" 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 tags: development
when: 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 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: true
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

5
workstation.yml Normal file
View File

@@ -0,0 +1,5 @@
- name: Install Workstation
hosts: localhost
become: true
roles:
- common