diff --git a/defaults/main.yaml b/defaults/main.yaml new file mode 100644 index 0000000..d111c07 --- /dev/null +++ b/defaults/main.yaml @@ -0,0 +1,11 @@ +--- +home_copy_pulseaudio_cookie: false +home_eralitex: false +home_access_to_hosts: [] +home_vnc_client_low_bandwidth: false +home_remote_workspace_config: false +home_kanboard_api_settings: false +kanboard_api_settings: "{{ lookup('file', '~/.eralitex/kanboard_api_settings.json' | from_json) }}" +# kanboard_api_url: https://kanboard.katyx.net/jsonrpc.php +# kanboard_api_user: ka +# kanboard_api_key: xxx diff --git a/tasks/eralitex.yaml b/tasks/eralitex.yaml new file mode 100644 index 0000000..abbde5b --- /dev/null +++ b/tasks/eralitex.yaml @@ -0,0 +1,30 @@ +--- + +- import_role: + name: eralitex + +- name: other workspace focus script + template: + src: other-workspace-focus.fish.j2 + dest: ~/.eralitex/workspace-cmd/other-focus + mode: 0755 + +- name: remote workspace focus scripts + template: + src: remote-workspace-focus.fish.j2 + dest: ~/.eralitex/workspace-cmd/{{workspace}}.focus + mode: 0755 + with_items: "{{workspaces|dict2items|json_query(\"[?value.type=='vdesk'].key\") }}" + loop_control: + loop_var: workspace + when: home_remote_workspace_config + +- name: remote workspace space shortcut scripts + template: + src: remote-workspace-space.fish.j2 + dest: ~/.eralitex/workspace-cmd/{{workspace}}.space + mode: 0755 + with_items: "{{workspaces|dict2items|json_query(\"[?value.type=='vdesk'||value.type=='tmux'].key\") }}" + loop_control: + loop_var: workspace + when: home_remote_workspace_config diff --git a/tasks/git.yaml b/tasks/git.yaml new file mode 100644 index 0000000..d3c5e56 --- /dev/null +++ b/tasks/git.yaml @@ -0,0 +1,6 @@ +--- + +- name: git config + template: + src: gitconfig.j2 + dest: ~/.gitconfig diff --git a/tasks/kanboard.yaml b/tasks/kanboard.yaml new file mode 100644 index 0000000..e102e88 --- /dev/null +++ b/tasks/kanboard.yaml @@ -0,0 +1,7 @@ +--- + +- name: kanboard api settings + copy: + content: "{{ kanboard_api_settings | to_json }}" + dest: ~/.eralitex/kanboard_api_settings.json + when: home_kanboard_api_settings diff --git a/tasks/main.yaml b/tasks/main.yaml index 5acfb05..7f75d5d 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -1,4 +1,10 @@ --- -- import_role: - name: eralitex +- import_tasks: ssh.yaml +- import_tasks: vnc.yaml +- import_tasks: tmux.yaml +- import_tasks: pulseaudio.yaml +- import_tasks: git.yaml + +- import_tasks: eralitex.yaml + when: home_eralitex diff --git a/tasks/pulseaudio.yaml b/tasks/pulseaudio.yaml new file mode 100644 index 0000000..838ea12 --- /dev/null +++ b/tasks/pulseaudio.yaml @@ -0,0 +1,8 @@ +--- + +- name: pulse cookie + copy: + src: ~/.pulse-cookie + dest: ~/.pulse-cookie + mode: 0600 + when: home_copy_pulseaudio_cookie diff --git a/tasks/ssh.yaml b/tasks/ssh.yaml new file mode 100644 index 0000000..b8927af --- /dev/null +++ b/tasks/ssh.yaml @@ -0,0 +1,7 @@ +--- + +- name: ssh-keys + copy: + src: ~/ssh-keys/ + dest: ~/ssh-keys + mode: u=rw,g=,o= diff --git a/tasks/tmux.yaml b/tasks/tmux.yaml new file mode 100644 index 0000000..f4e7cdb --- /dev/null +++ b/tasks/tmux.yaml @@ -0,0 +1,7 @@ +--- + +- name: tmux config + template: + src: tmux.conf.j2 + dest: ~/.tmux.conf + mode: 0755 diff --git a/tasks/vnc.yaml b/tasks/vnc.yaml new file mode 100644 index 0000000..6867262 --- /dev/null +++ b/tasks/vnc.yaml @@ -0,0 +1,32 @@ +--- + +- name: vnc directory + file: + path: ~/.vnc + state: directory + mode: 0700 + +- name: vnc passwd + copy: + content: "{{ lookup('pipe','pwgen 24 1' )}}" + dest: ~/.vnc/passwd + mode: 0600 + force: no + +- name: fetch vnc passwd + fetch: + src: ~/.vnc/passwd + dest: ~/.vnc/passwd.{{inventory_hostname}} + flat: yes + +- name: copy vnc passwd files + copy: + src: ~/.vnc/passwd.{{item}} + dest: ~/.vnc/passwd.{{item}} + with_items: "{{ home_access_to_hosts }}" + +- name: vnc options + template: + src: vnc-options.fish.j2 + dest: ~/.eralitex/workspace-cmd/vnc-options + mode: 0755 diff --git a/templates/default.tigervnc.j2 b/templates/default.tigervnc.j2 new file mode 100644 index 0000000..ff93b33 --- /dev/null +++ b/templates/default.tigervnc.j2 @@ -0,0 +1,10 @@ +TigerVNC Configuration file Version 1.0 +MenuKey=Pause +{% if vnc_client_low_bandwidth %} +AutoSelect=0 +QualityLevel=0 +FullColor=0 +LowColorLevel=2 +PreferredEncoding=Tight +CompressLevel=0 +{% endif %} diff --git a/templates/gitconfig.j2 b/templates/gitconfig.j2 new file mode 100644 index 0000000..0c5f7c1 --- /dev/null +++ b/templates/gitconfig.j2 @@ -0,0 +1,3 @@ +[user] + email = markus.katharina.brechtel@thengo.net + name = Markus Katharina Brechtel diff --git a/templates/other-workspace-focus.fish.j2 b/templates/other-workspace-focus.fish.j2 new file mode 100644 index 0000000..c05ead0 --- /dev/null +++ b/templates/other-workspace-focus.fish.j2 @@ -0,0 +1,3 @@ +#!/usr/bin/fish +{{ ansible_managed | comment }} +i3-msg mode default diff --git a/templates/remote-workspace-focus.fish.j2 b/templates/remote-workspace-focus.fish.j2 new file mode 100644 index 0000000..44f6afb --- /dev/null +++ b/templates/remote-workspace-focus.fish.j2 @@ -0,0 +1,3 @@ +#!/usr/bin/fish +{{ ansible_managed | comment }} +i3-msg mode remote diff --git a/templates/remote-workspace-space.fish.j2 b/templates/remote-workspace-space.fish.j2 new file mode 100644 index 0000000..ba836e7 --- /dev/null +++ b/templates/remote-workspace-space.fish.j2 @@ -0,0 +1,8 @@ +#!/usr/bin/fish +{{ ansible_managed | comment }} +{% if workspaces[workspace].type == "vdesk" %} +source (dirname (status --current-filename))/vnc-options +xtigervncviewer localhost:{{workspaces[workspace].display|default(16)}} -via {{workspaces[workspace].host}} -PasswordFile ~/.vnc/passwd.{{workspaces[workspace].host}} +{% elif workspaces[workspace].type == "tmux" %} +urxvt -title tmux-workspace -e fish -c 'ssh -t {{workspaces[workspace].host}} tmux attach -d -t {{workspaces[workspace].session}}' +{% endif %} diff --git a/templates/tmux.conf.j2 b/templates/tmux.conf.j2 new file mode 100644 index 0000000..d957dee --- /dev/null +++ b/templates/tmux.conf.j2 @@ -0,0 +1 @@ +set-option -g status-position top diff --git a/templates/tmux@.service.j2 b/templates/tmux@.service.j2 new file mode 100644 index 0000000..7c2f1e7 --- /dev/null +++ b/templates/tmux@.service.j2 @@ -0,0 +1,10 @@ +[Unit] +Description=tmux session + +[Service] +Type=forking +ExecStart=/usr/bin/tmux new-session -s %i -d +ExecStop=/usr/bin/tmux kill-session -t %i + +[Install] +WantedBy=default.target diff --git a/templates/vnc-options.fish.j2 b/templates/vnc-options.fish.j2 new file mode 100644 index 0000000..aaa2232 --- /dev/null +++ b/templates/vnc-options.fish.j2 @@ -0,0 +1,4 @@ +#!/usr/bin/fish +{{ ansible_managed | comment }} +#set -a vnc_options -MenuKey Pause +#set -a vnc_options -AutoSelect=0 -QualityLevel=0 -FullColor=0 -LowColorLevel=2 -PreferredEncoding=Tight -CompressLevel=0