From afcbc020bd78ba7257002846633a580aa5dd55dd Mon Sep 17 00:00:00 2001
From: binary <me@rgoncalves.se>
Date: Sun, 27 Dec 2020 19:24:27 +0100
Subject: Add openbsd workstation init

---
 roles/workstation/tasks/main.yml | 87 +++++++++++++++++++++++++++++++++-------
 1 file changed, 73 insertions(+), 14 deletions(-)

diff --git a/roles/workstation/tasks/main.yml b/roles/workstation/tasks/main.yml
index f9c2852..41a640c 100644
--- a/roles/workstation/tasks/main.yml
+++ b/roles/workstation/tasks/main.yml
@@ -1,31 +1,90 @@
 
 # workstation ~~ roles/workstation/tasks/main.yml
-# init workstation with packages and dotfiles
+# init workstation
 
 ---
 
-- name: select correct distribution packages
+- name: retrieve BECOME method
+  stat: path=/usr/bin/doas 
+  register: ws_become
+
+- name: retrieve host facts
   set_fact:
-    packages: "{{ packages[ansible_distribution | lower] }}"
+    ws_distribution: "{{ ansible_distribution | lower }}"
+    ansible_become_method: "{{ 'doas' if ws_become.stat.exists else 'sudo' }}"
+    ansible_become_user: root
 
 - name: download development packages
-  package: name="{{ packages[item] }}" state=present
+  package: name="{{ item }}" state=present
   loop:
+    # DEVEL
+    - base
+    - base-devel
+    - go
+    # EDITOR
+    - emacs
     - neovim
-    #- qutebrowser
-    #- vlc
-    #- feh
+    - python-neovim
+    - py3-neovim
+    # PYTHON
+    - python-pip
+    - py3-pip
+    - python-requests
+    - py3-requests
+    - python-jedi
+    - py3-jedi
+    # UTILS
+    - i3
+    - i3status
+    - gnupg
+    - py3-pip
+    - python-pip
+    - zsh
+    - zip
+    - unzip
+    - tar
+    - git
+    - curl
+    - wget
+    - wireguard
+    - wireguard-dkms
+    - wireguard-tools
+    # PRIVACY
+    - tor
+    - tor-browser
+    - torsocks
+    # MULTIMEDIA
+    - qutebrowser
+    - firefox
+    - feh
+    - imv
+    - mpv
+    - cmus
+    - vlc
+    - syncthing
+  failed_when: false
   ignore_errors: true
-  become: true
+  tags: packages
+
+- name: flush fonts cache
+  shell: fc-cache -fv
+
+- name: check for distribution specific task
+  stat: path="{{ role_path }}/tasks/setup_{{ ws_distribution }}.yml"
+  register: ws_distribution_task
+
+- debug:
+    var: ws_distribution_task
+
+- name: include distribution specific task
+  include_tasks: "setup_{{ ws_distribution }}.yml"
+  when: ws_distribution_task.stat.exists
 
-- name: ensure dotfiles local directory exists
-  file:
-    path: "{{ workstation_dotfiles_dir }}"
-    state: directory
-    mode: 0755
+- name: gracefully stop playbook and skip testing tasks
+  meta: end_host
 
 - name: download dotfiles configuration repository
   git: 
     repo: "{{ workstation_git_root }}/dot-config"
-    dest: "{{ workstation_dotfiles_dir }}/dot-config"
+    dest: "{{ workstation_dotfiles_dir }}/config"
     bare: true
-- 
cgit v1.2.3