aboutsummaryrefslogtreecommitdiffstats
path: root/roles/workstation
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-02-17 16:54:09 +0100
committerbinary <me@rgoncalves.se>2021-02-17 16:54:09 +0100
commite3a63f27b69b18b59ff61c563a31de8b7fbe8482 (patch)
tree9788e25e51654df8065dee2f5e273be951aa22db /roles/workstation
parent473987f9e0ed2d6fe7585ea30634ed8d0a1dc721 (diff)
downloadinfrastructure-e3a63f27b69b18b59ff61c563a31de8b7fbe8482.tar.gz
Add openbsd setup for workstation
Diffstat (limited to 'roles/workstation')
-rw-r--r--roles/workstation/tasks/_openbsd.yml90
-rw-r--r--roles/workstation/tasks/main.yml26
-rw-r--r--roles/workstation/tasks/setup_openbsd.yml43
-rw-r--r--roles/workstation/templates/etc-X11-xorg.conf.d-intel.conf9
-rw-r--r--roles/workstation/vars/main.yml65
5 files changed, 170 insertions, 63 deletions
diff --git a/roles/workstation/tasks/_openbsd.yml b/roles/workstation/tasks/_openbsd.yml
new file mode 100644
index 0000000..48630bb
--- /dev/null
+++ b/roles/workstation/tasks/_openbsd.yml
@@ -0,0 +1,90 @@
+
+# workstation ~~ roles/workstation/tasks/main.yml
+# init openbsd based workstation
+
+---
+
+- name: install packages
+ shell: pkg_add -z {{ item | join(" ") }}
+ loop:
+ - "{{ pkgs_common }}"
+ - "{{ pkgs_openbsd }}"
+ register: out
+ tags: ws_tag_pkgs
+
+- name: packages installation output
+ debug:
+ msg: |
+ {% for item in out.results %}
+ - {{ item.cmd }}
+ {% for type in ["stdout_lines", "stderr_lines"] if item[type] %}
+ -- {{ type }}
+ {% for line in item[type] %}
+ --- {{ line }}
+ {% endfor %}
+ {% endfor %}
+ {% endfor %}
+ when: out is defined
+
+- name: ensure wsconsctl config file exists
+ file:
+ path: /etc/wsconsctl.conf
+ owner: root
+ group: wheel
+ mode: 0644
+ state: touch
+
+- name: append configuration to wsconsctl
+ lineinfile:
+ path: /etc/wsconsctl.conf
+ regexp: "^{{ item[0] }}"
+ line: "{{ item[0] }}={{ item[1] }}"
+ loop:
+ - [screen.brightness, 80]
+ - [keyboard.repeat.del1, 180]
+ - [keyboard.repeat.deln, 50]
+ - [keyboard.bell.volume, 0]
+ - [mouse.tp.tapping, 1]
+
+- name: ensure Xorg subdirectory for configuration exists
+ file:
+ path: /etc/X11/xorg.conf.d
+ owner: root
+ mode: 0644
+ state: directory
+
+- name: generate Xorg configuration for intel gpu and screen tearing
+ template:
+ src: etc-X11-xorg.conf.d-intel.conf
+ dest: /etc/X11/xorg.conf.d/intel.conf
+
+- name: ensure sysctl configuration file exists
+ file:
+ path: /etc/sysctl.conf
+ owner: root
+ mode: 0644
+
+- name: ensure sysctl memory optimizations
+ blockinfile:
+ path: /etc/sysctl.conf
+ block: |
+ kern.shminfo.shmall=3145728
+ kern.shminfo.shmmax=1073741823
+ kern.shminfo.shmmni=1024
+ kern.shminfo.shmseg=1024
+ kern.seminfo.semmns=4096
+ kern.seminfo.semmni=1024
+ marker: "# memory - managed by Ansible"
+
+- name: ensure sysctl process optimizations
+ blockinfile:
+ path: /etc/sysctl.conf
+ block: |
+ kern.maxfiles=102400
+ kern.maxproc=32768
+ kern.maxfiles=65535
+ kern.bufcachepercent=90
+ kern.maxvnodes=262144
+ kern.somaxconn=2048
+ marker: "# process - managed by Ansible"
+
diff --git a/roles/workstation/tasks/main.yml b/roles/workstation/tasks/main.yml
index 6aa3322..2789c9b 100644
--- a/roles/workstation/tasks/main.yml
+++ b/roles/workstation/tasks/main.yml
@@ -8,29 +8,19 @@
stat: path=/usr/bin/doas
register: ws_become
+- name: retrieve original user
+ shell: logname
+ register: ws_user
+
- name: retrieve host facts
set_fact:
- ws_distribution: "{{ ansible_distribution | lower }}"
ansible_become_method: "{{ 'doas' if ws_become.stat.exists else 'sudo' }}"
ansible_become_user: root
-
-- name: download packages
- include_tasks: packages.yml
- tags: packages
-
-- name: check for distribution specific task
- stat: path="{{ role_path }}/tasks/setup_{{ ws_distribution }}.yml"
- register: ws_distribution_task
+ ws_user: ws_user.results.stdout
- name: include distribution specific task
- include_tasks: "setup_{{ ws_distribution }}.yml"
- when: ws_distribution_task.stat.exists
+ include_tasks: "_{{ ansible_distribution | lower }}.yml"
+ ignore_errors: true
-- name: gracefully stop playbook and skip testing tasks
+- name: setup dotfiles from upstream and user script
meta: end_host
-
-- name: download dotfiles configuration repository
- git:
- repo: "{{ workstation_git_root }}/dot-config"
- dest: "{{ workstation_dotfiles_dir }}/config"
- bare: true
diff --git a/roles/workstation/tasks/setup_openbsd.yml b/roles/workstation/tasks/setup_openbsd.yml
deleted file mode 100644
index bf4fb6c..0000000
--- a/roles/workstation/tasks/setup_openbsd.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-# workstation ~~ roles/workstation/tasks/main.yml
-# init openbsd based workstation
-
----
-
-- name: ensure wsconsctl config file exists
- file:
- path: /etc/wsconsctl.conf
- owner: root
- group: wheel
- mode: 0644
- state: touch
-
-- name: wsconsctl screen default screenbrightness
- lineinfile:
- path: /etc/wsconsctl.conf
- regexp: ^screen.brightness=
- line: screen.brightness=80
-
-- name: wsconsctl keyboard default acceleration
- lineinfile:
- path: /etc/wsconsctl.conf
- regexp: ^keyboard.repeat.del1=
- line: keyboard.repeat.del1=180
-
-- name: wsconsctl keyboard default acceleration
- lineinfile:
- path: /etc/wsconsctl.conf
- regexp: ^keyboard.repeat.deln=
- line: keyboard.repeat.deln=50
-
-- name: wsconctl disable keyboard bell
- lineinfile:
- path: /etc/wsconsctl.conf
- regexp: ^keyboard.bell.volume=
- line: keyboard.bell.volume=0
-
-- name: wsconctl enable touchpad tapping
- lineinfile:
- path: /etc/wsconsctl.conf
- regexp: ^mouse.tp.tapping=
- line: mouse.tp.tapping=1
diff --git a/roles/workstation/templates/etc-X11-xorg.conf.d-intel.conf b/roles/workstation/templates/etc-X11-xorg.conf.d-intel.conf
new file mode 100644
index 0000000..5d73c65
--- /dev/null
+++ b/roles/workstation/templates/etc-X11-xorg.conf.d-intel.conf
@@ -0,0 +1,9 @@
+
+# disable tearscreen for Xenocara on OpenBSD
+# managed by Ansible
+
+Section "Device"
+ Identifier "drm"
+ Driver "intel"
+ Option "TearFree" "true"
+EndSection
diff --git a/roles/workstation/vars/main.yml b/roles/workstation/vars/main.yml
index 6f19118..7e5cee2 100644
--- a/roles/workstation/vars/main.yml
+++ b/roles/workstation/vars/main.yml
@@ -4,5 +4,66 @@
---
-workstation_git_root: git@10.10.0.62:/data/git
-workstation_dotfiles_dir: ~/.dotfiles.d
+pkgs_common:
+ # desktop (backup over dwm)
+ - bemenu
+ - i3
+ - i3status
+ # editor
+ - neovim
+ # files
+ - curl
+ - git
+ - syncthing
+ - tar
+ - unzip
+ - wget
+ - zip
+ # lang
+ - ansible
+ - go
+ - rust
+ # multimedia
+ - cmus
+ - feh
+ - firefox
+ - mpv
+ - qutebrowser
+ - vlc
+ # tools
+ - gnupg
+ - htop
+ - tor
+ - zsh
+
+pkgs_archlinux:
+ # devel
+ - base-devel
+ # editor
+ - emacs
+ # sys
+ - base
+ # python
+ - python-jedi
+ - python-neovim
+ - python-pip
+ - python-requests
+ # net
+ - wireguard-dkms
+
+pkgs_openbsd:
+ # devel
+ - automake--%1.16
+ - clang-tools-extra
+ - free
+ # editor
+ - emacs--no_x11%emacs
+ # net
+ - tor-browser
+ - torsocks
+ - wireguard-tools
+ # python
+ - py3-jedi
+ - py3-neovim
+ - py3-pip
+ - py3-requests
remember that computers suck.