aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2022-10-01 22:28:22 +0200
committerRomain Gonçalves <me@rgoncalves.se>2022-10-01 22:28:55 +0200
commitc8de512a98462327b909311d2f89c90c32fb9246 (patch)
treedf11ba3e4c005644e1a4a9c61b8790523333a6ee
parente91ac09b9ed3d3768b99315c13366da23a13a3fa (diff)
downloadinfrastructure-c8de512a98462327b909311d2f89c90c32fb9246.tar.gz
chore: migrate package install in distinct roles
-rw-r--r--roles/workstation/defaults/main.yml2
-rw-r--r--roles/workstation/tasks/dockerd.yml13
-rw-r--r--roles/workstation/tasks/libvirt.yml4
-rw-r--r--roles/workstation/tasks/main.yml33
-rw-r--r--roles/workstation/tasks/os_archlinux.yml48
-rw-r--r--roles/workstation/tasks/pipewire.yml21
-rw-r--r--roles/workstation/tasks/pkgs.yml2
-rw-r--r--roles/workstation/vars/os_archlinux.yml7
-rw-r--r--roles/workstation/vars/os_openbsd.yml1
9 files changed, 64 insertions, 67 deletions
diff --git a/roles/workstation/defaults/main.yml b/roles/workstation/defaults/main.yml
index 591c7e2..a7c0ab6 100644
--- a/roles/workstation/defaults/main.yml
+++ b/roles/workstation/defaults/main.yml
@@ -1,5 +1,7 @@
workstation_user: qwd
+workstation_docker_group: docker
+
workstation_hosts_file: /etc/hosts
workstation_hosts_url: "https://raw.githubusercontent.com/\
StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts"
diff --git a/roles/workstation/tasks/dockerd.yml b/roles/workstation/tasks/dockerd.yml
index dc1c268..df85dd5 100644
--- a/roles/workstation/tasks/dockerd.yml
+++ b/roles/workstation/tasks/dockerd.yml
@@ -1,3 +1,16 @@
+- name: install docker
+ package:
+ name:
+ - docker
+ - docker-compose
+ state: present
+
+- name: append current user to docker group
+ user:
+ name: "{{ workstation_user }}"
+ groups: "{{ workstation_docker_group }}"
+ append: true
+
- name: create docker directory
file:
path: /etc/docker
diff --git a/roles/workstation/tasks/libvirt.yml b/roles/workstation/tasks/libvirt.yml
index 36d3fa5..ef9e85b 100644
--- a/roles/workstation/tasks/libvirt.yml
+++ b/roles/workstation/tasks/libvirt.yml
@@ -1,3 +1,7 @@
+- name: install iptables-nft
+ shell: yes | pacman --noprogressbar --needed --sync iptables-nft
+ when: ansible_distribution == "Archlinux"
+
- name: install libvirt
package:
name:
diff --git a/roles/workstation/tasks/main.yml b/roles/workstation/tasks/main.yml
index 205834f..ea772d6 100644
--- a/roles/workstation/tasks/main.yml
+++ b/roles/workstation/tasks/main.yml
@@ -2,46 +2,23 @@
include_vars: "os_{{ ansible_distribution | lower }}.yml"
- name: include packages
- tags: always
- include_tasks:
- file: pkgs.yml
- apply:
- tags: task_pkgs
+ include_tasks: pkgs.yml
- name: include operating system setup
- tags: always
- include_tasks:
- file: "os_{{ ansible_distribution | lower }}.yml"
- apply:
- tags: task_system
+ include_tasks: "os_{{ ansible_distribution | lower }}.yml"
- name: include shell setup
- tags: always
- include_tasks:
- file: shell.yml
- apply:
- tags: task_shell
+ include_tasks: shell.yml
- name: include doas setup
- tags: always
- include_tasks:
- file: doas.yml
- apply:
- tags: task_doas
+ include_tasks: doas.yml
- name: include smartcard setup
- tags: always
- include_tasks:
- file: smartcard.yml
- apply:
- tags: task_smartcard
+ include_tasks: smartcard.yml
- name: include ssh setup
- tags: always
include_tasks:
file: ssh.yml
- apply:
- tags: task_ssh
args:
apply:
become: true
diff --git a/roles/workstation/tasks/os_archlinux.yml b/roles/workstation/tasks/os_archlinux.yml
index 70d7abd..76d78c5 100644
--- a/roles/workstation/tasks/os_archlinux.yml
+++ b/roles/workstation/tasks/os_archlinux.yml
@@ -1,35 +1,4 @@
-- name: append current user to system groups
- user:
- name: "{{ workstation_user }}"
- groups: "{{ item }}"
- append: true
- loop:
- - docker
- - wheel
- - video
- - audio
-
-- name: enable and start pipewire
- systemd:
- name: "{{ item }}"
- scope: user
- enabled: true
- state: started
- become: true
- become_method: su
- become_user: "{{ workstation_user }}"
- loop:
- - pipewire
- - pipewire-pulse
- when: ansible_service_mgr == "systemd"
-
-- name: ensure that dhcpcd is started
- service:
- name: dhcpcd
- state: started
- enabled: true
-
-- name: enable battery optimization
+- name: include battery optimization
include_tasks: tlp.yml
when: ansible_form_factor in ["Laptop", "Notebook"]
@@ -39,12 +8,25 @@
- name: include dockerd setup
include_tasks: dockerd.yml
+- name: include pipewire
+ include_tasks: pipewire.yml
+
- name: retrieve installed packages
package_facts:
register: package_facts
-- name: install yay
+- name: include yay
include_tasks: yay.yml
when:
- "'yay' not in package_facts.ansible_facts.packages"
- "'yay-bin' not in package_facts.ansible_facts.packages"
+
+- name: append current user to system groups
+ user:
+ name: "{{ workstation_user }}"
+ groups: "{{ item }}"
+ append: true
+ loop:
+ - wheel
+ - video
+ - audio
diff --git a/roles/workstation/tasks/pipewire.yml b/roles/workstation/tasks/pipewire.yml
new file mode 100644
index 0000000..1192563
--- /dev/null
+++ b/roles/workstation/tasks/pipewire.yml
@@ -0,0 +1,21 @@
+- name: install pipewire
+ package:
+ name:
+ - pipewire
+ - pipewire-alsa
+ - pipewire-pulse
+ state: present
+
+- name: enable and start pipewire
+ systemd:
+ name: "{{ item }}"
+ scope: user
+ enabled: true
+ state: started
+ become: true
+ become_method: su
+ become_user: "{{ workstation_user }}"
+ loop:
+ - pipewire
+ - pipewire-pulse
+ when: ansible_service_mgr == "systemd"
diff --git a/roles/workstation/tasks/pkgs.yml b/roles/workstation/tasks/pkgs.yml
index f4f2f44..abc583e 100644
--- a/roles/workstation/tasks/pkgs.yml
+++ b/roles/workstation/tasks/pkgs.yml
@@ -2,6 +2,6 @@
package:
name: "{{ item }}"
state: present
- loop:
+ loop:
- "{{ workstation_pkgs_common }}"
- "{{ workstation_pkgs }}"
diff --git a/roles/workstation/vars/os_archlinux.yml b/roles/workstation/vars/os_archlinux.yml
index e539c2b..bde503f 100644
--- a/roles/workstation/vars/os_archlinux.yml
+++ b/roles/workstation/vars/os_archlinux.yml
@@ -5,14 +5,14 @@ workstation_pkgs:
- bc
- bind
- clang
- - docker
- - docker-compose
+ - cronie
- easyeffects
- entr
- firefox
- go
- go-tools
- gopls
+ - httpie
- imagemagick
- inetutils
- libvirt
@@ -28,9 +28,6 @@ workstation_pkgs:
- pavucontrol
- pcsc-tools
- pdfjs
- - pipewire
- - pipewire-alsa
- - pipewire-pulse
- postgresql
- pyenv
- python-debugpy
diff --git a/roles/workstation/vars/os_openbsd.yml b/roles/workstation/vars/os_openbsd.yml
index 4c3dc8b..da3d206 100644
--- a/roles/workstation/vars/os_openbsd.yml
+++ b/roles/workstation/vars/os_openbsd.yml
@@ -4,6 +4,7 @@ workstation_pkgs:
- mozilla-firefox
- pcsc-lite
- pcsc-tools
+ - py-httpie
- py3-neovim
- py3-netaddr
- py3-pip
remember that computers suck.