Desktop setup
This commit is contained in:
commit
a7eaa7dbfb
14 changed files with 325 additions and 0 deletions
87
roles/common/tasks/main.yml
Normal file
87
roles/common/tasks/main.yml
Normal file
|
@ -0,0 +1,87 @@
|
|||
---
|
||||
|
||||
- name: Install common apt packages
|
||||
apt:
|
||||
name:
|
||||
- zsh
|
||||
- mdadm
|
||||
- direnv
|
||||
- mpv
|
||||
- tmux
|
||||
- htop
|
||||
- baobab
|
||||
- openssh-server
|
||||
- chrome-gnome-shell
|
||||
- python3-pip
|
||||
- cheese
|
||||
- geary
|
||||
- baobab
|
||||
- curl
|
||||
- celluloid
|
||||
- openssh-server
|
||||
- neofetch
|
||||
- gnome-boxes
|
||||
- virt-manager
|
||||
- vim
|
||||
- blueman
|
||||
- pavucontrol
|
||||
- gnome-shell-extension-shortcuts
|
||||
- gnome-shell-extension-system-monitor
|
||||
- gnome-shell-extension-top-icons-plus
|
||||
- gnome-shell-extension-gsconnect
|
||||
- gnome-shell-extension-gsconnect-browsers
|
||||
- gnome-nettool
|
||||
- gnome-maps
|
||||
- gnome-calendar
|
||||
- gnome-clocks
|
||||
state: present
|
||||
become: yes
|
||||
|
||||
- name: Install common snaps with --classic
|
||||
snap:
|
||||
name:
|
||||
- microk8s
|
||||
classic: yes
|
||||
state: present
|
||||
become: yes
|
||||
|
||||
- name: Install common snaps
|
||||
snap:
|
||||
name:
|
||||
- code
|
||||
- chromium
|
||||
- canonical-livepatch
|
||||
- dbeaver-ce
|
||||
- discord
|
||||
- glimpse-editor
|
||||
- qownnotes
|
||||
- remmina
|
||||
- riot-web
|
||||
- spotify
|
||||
- vlc
|
||||
- zoom-client
|
||||
state: present
|
||||
become: yes
|
||||
|
||||
- name: Uninstall default pulseaudio-module-bluetooth
|
||||
apt:
|
||||
name: pulseaudio-module-bluetooth
|
||||
state: absent
|
||||
become: yes
|
||||
|
||||
- name: Install bluetooth audio deps
|
||||
apt:
|
||||
name:
|
||||
- libavcodec-extra58
|
||||
- libfdk-aac1
|
||||
- bluez
|
||||
- pulseaudio
|
||||
become: yes
|
||||
|
||||
- name: Install bluetooth audio codec debs
|
||||
apt:
|
||||
deb: "{{item}}"
|
||||
with_items:
|
||||
- https://f.bytefuse.net/pulseaudio-modules-bt-ppa/focal/libldac_2.0.2.3-1_amd64.deb
|
||||
- https://f.bytefuse.net/pulseaudio-modules-bt-ppa/focal/pulseaudio-modules-bt_1.3-1_amd64.deb
|
||||
become: yes
|
22
roles/docker/tasks/main.yml
Normal file
22
roles/docker/tasks/main.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
|
||||
- name: Install docker
|
||||
apt: name=docker.io state=present
|
||||
become: yes
|
||||
|
||||
- name: Make sure docker is running
|
||||
systemd:
|
||||
state: started
|
||||
name: docker
|
||||
become: yes
|
||||
|
||||
- name: Install docker-compose
|
||||
apt: name=docker-compose state=present
|
||||
become: yes
|
||||
|
||||
- name: Add jonathan to docker group
|
||||
user:
|
||||
name: jonathan
|
||||
groups: docker
|
||||
append: yes
|
||||
become: yes
|
29
roles/network/tasks/main.yml
Normal file
29
roles/network/tasks/main.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
|
||||
- name: Try nmcli add Ethernet - conn_name only & ip4 gw4
|
||||
nmcli:
|
||||
type: ethernet
|
||||
conn_name: "Wired connection 1"
|
||||
ifname: enp8s0
|
||||
ip4: 10.0.1.2
|
||||
gw4: 10.0.1.1
|
||||
dns4: 9.9.9.9
|
||||
state: present
|
||||
become: yes
|
||||
|
||||
- name: Try nmcli add Ethernet - conn_name only & ip4 gw4
|
||||
nmcli:
|
||||
type: ethernet
|
||||
conn_name: "Wired connection 2"
|
||||
ifname: enp9s0
|
||||
ip4: 10.0.1.9
|
||||
gw4: 10.0.1.1
|
||||
dns4: 9.9.9.9
|
||||
state: present
|
||||
become: yes
|
||||
|
||||
- name: Restart network
|
||||
service:
|
||||
name: NetworkManager
|
||||
state: restarted
|
||||
become: yes
|
11
roles/raid/tasks/main.yml
Normal file
11
roles/raid/tasks/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
|
||||
- name: Mount mdadm arrays
|
||||
mount:
|
||||
path: "{{ item.path }}"
|
||||
src: "{{ item.device }}"
|
||||
fstype: ext4
|
||||
state: mounted
|
||||
loop:
|
||||
- { device: /dev/md0, path: /data }
|
||||
become: yes
|
20
roles/users/tasks/main.yml
Normal file
20
roles/users/tasks/main.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
|
||||
- name: Add user jonathan
|
||||
user:
|
||||
name: jonathan
|
||||
comment: Jonathan Cremin
|
||||
uid: 1000
|
||||
groups: jonathan,adm,cdrom,sudo,dip,plugdev,lpadmin,lxd,sambashare
|
||||
shell: /bin/zsh
|
||||
append: yes
|
||||
become: yes
|
||||
|
||||
- name: Passwordless sudo for jonathan
|
||||
lineinfile:
|
||||
path: /etc/sudoers
|
||||
state: present
|
||||
regexp: '^%sudo'
|
||||
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
|
||||
validate: /usr/sbin/visudo -cf %s
|
||||
become: yes
|
7
roles/vm/handlers/main.yml
Normal file
7
roles/vm/handlers/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: restart libvirtd
|
||||
service:
|
||||
name: libvirtd
|
||||
state: restarted
|
||||
become: yes
|
||||
|
68
roles/vm/tasks/main.yml
Normal file
68
roles/vm/tasks/main.yml
Normal file
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
|
||||
- name: Install vm deps
|
||||
apt:
|
||||
name:
|
||||
- libvirt-daemon-system
|
||||
- libvirt-clients
|
||||
- qemu-kvm
|
||||
- qemu-utils
|
||||
- virt-manager
|
||||
- ovmf
|
||||
become: yes
|
||||
|
||||
- name: Update grub for amd_iommu
|
||||
lineinfile:
|
||||
path: /etc/default/grub
|
||||
state: present
|
||||
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT='
|
||||
line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=on"'
|
||||
become: yes
|
||||
|
||||
- name: Create subdirectories
|
||||
file:
|
||||
dest: '{{item}}'
|
||||
mode: '0755'
|
||||
owner: root
|
||||
group: root
|
||||
state: directory
|
||||
with_items:
|
||||
- /etc/libvirt/hooks/
|
||||
- /etc/libvirt/hooks/qemu.d/win10/prepare/begin/
|
||||
- /etc/libvirt/hooks/qemu.d/win10/release/end/
|
||||
become: yes
|
||||
|
||||
- name: Fetch libvirt qemu hook
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/PassthroughPOST/VFIO-Tools/master/libvirt_hooks/qemu
|
||||
dest: /etc/libvirt/hooks/qemu
|
||||
mode: 0744
|
||||
become: yes
|
||||
notify: restart libvirtd
|
||||
|
||||
- name: Create kvm.conf
|
||||
template:
|
||||
src: kvm.conf.j2
|
||||
dest: /etc/libvirt/hooks/kvm.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
become: yes
|
||||
|
||||
- name: bind_vfio.sh
|
||||
template:
|
||||
src: bind_vfio.sh.j2
|
||||
dest: /etc/libvirt/hooks/qemu.d/win10/prepare/begin/bind_vfio.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0744'
|
||||
become: yes
|
||||
|
||||
- name: unbind_vfio.sh
|
||||
template:
|
||||
src: unbind_vfio.sh.j2
|
||||
dest: /etc/libvirt/hooks/qemu.d/win10/release/end/unbind_vfio.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0744'
|
||||
become: yes
|
13
roles/vm/templates/bind_vfio.sh.j2
Normal file
13
roles/vm/templates/bind_vfio.sh.j2
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Load the config file
|
||||
source "/etc/libvirt/hooks/kvm.conf"
|
||||
|
||||
## Load vfio
|
||||
modprobe vfio
|
||||
modprobe vfio_iommu_type1
|
||||
modprobe vfio_pci
|
||||
|
||||
## Unbind gpu from nvidia and bind to vfio
|
||||
virsh nodedev-detach $VIRSH_GPU_VIDEO
|
||||
virsh nodedev-detach $VIRSH_GPU_AUDIO
|
3
roles/vm/templates/kvm.conf.j2
Normal file
3
roles/vm/templates/kvm.conf.j2
Normal file
|
@ -0,0 +1,3 @@
|
|||
## Virsh devices
|
||||
VIRSH_GPU_VIDEO=pci_0000_0c_00_0
|
||||
VIRSH_GPU_AUDIO=pci_0000_0c_00_1
|
13
roles/vm/templates/unbind_vfio.sh.j2
Normal file
13
roles/vm/templates/unbind_vfio.sh.j2
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Load the config file
|
||||
source "/etc/libvirt/hooks/kvm.conf"
|
||||
|
||||
## Unbind gpu from vfio and bind to nvidia
|
||||
virsh nodedev-reattach $VIRSH_GPU_VIDEO
|
||||
virsh nodedev-reattach $VIRSH_GPU_AUDIO
|
||||
|
||||
## Unload vfio
|
||||
modprobe -r vfio_pci
|
||||
modprobe -r vfio_iommu_type1
|
||||
modprobe -r vfio
|
Loading…
Add table
Add a link
Reference in a new issue