From 4f88b7953dbeaaca3d66401231d376caaee10fa9 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Thu, 16 Feb 2023 10:03:09 +0100 Subject: [PATCH 1/9] add i3 config --- roles/i3/files/config | 143 ++++++++++++++++++++++++++++++++++++++++ roles/i3/tasks/main.yml | 15 +++++ 2 files changed, 158 insertions(+) create mode 100644 roles/i3/files/config create mode 100644 roles/i3/tasks/main.yml diff --git a/roles/i3/files/config b/roles/i3/files/config new file mode 100644 index 0000000..de983bf --- /dev/null +++ b/roles/i3/files/config @@ -0,0 +1,143 @@ +set $mod Mod4 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec i3-sensible-terminal + +# kill focused window +bindsym $mod+Shift+q kill + +# program picker +bindsym $mod+d exec --no-startup-id "rofi -modi drun,run -show drun" + +# change focus +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right +bindsym $mod+h focus left + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# toggle split direction +bindsym $mod+t split toggle + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + bindsym l resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym j resize shrink height 10 px or 10 ppt + bindsym h resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + status_command i3status +} + +focus_follows_mouse no + +bindsym $mod+Escape exec i3lock diff --git a/roles/i3/tasks/main.yml b/roles/i3/tasks/main.yml new file mode 100644 index 0000000..ca1c9a2 --- /dev/null +++ b/roles/i3/tasks/main.yml @@ -0,0 +1,15 @@ +- name: Install packages + become: true + apt: + pkg: + - i3-wm + - rofi + - i3lock +- name: Create i3 config directory + file: + path: ~/.config/i3 + state: directory +- name: Copy i3 config + copy: + src: "{{ role_path }}/files/config" + dest: ~/.config/i3/config -- 2.45.2 From 3be31f7ac1668c9236897829ff67022b7072a1d0 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Mon, 20 Feb 2023 21:57:30 +0100 Subject: [PATCH 2/9] remove old i3 config --- roles/system/files/Xresources | 5 ----- roles/system/tasks/main.yml | 4 ---- 2 files changed, 9 deletions(-) delete mode 100644 roles/system/files/Xresources diff --git a/roles/system/files/Xresources b/roles/system/files/Xresources deleted file mode 100644 index 7c3ddfb..0000000 --- a/roles/system/files/Xresources +++ /dev/null @@ -1,5 +0,0 @@ -i3-wm.binding.split_h: c -i3-wm.binding.launcher.app: d - -i3-wm.binding.display: F1 -i3-wm.binding.settings: F2 diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index 57479c5..2e11fbb 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -19,10 +19,6 @@ template: src: "{{ role_path }}/templates/.gitconfig.j2" dest: ~/.gitconfig -- name: Copy Xresources - copy: - src: "{{ role_path }}/files/Xresources" - dest: ~/.config/regolith2/Xresources - name: Create keepassxc config directory file: path: ~/.config/keepassxc -- 2.45.2 From 1c5eb3fc64bd228d2d6efd3abd60ab9bd1a2f12b Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Mon, 20 Feb 2023 22:31:36 +0100 Subject: [PATCH 3/9] put distribution release as host variable to accomodate linux mint --- inventory/host_vars/self.yml | 1 + roles/alacritty/tasks/main.yml | 2 +- roles/neovim/tasks/main.yml | 2 +- roles/nicotine/tasks/main.yml | 2 +- roles/strawberry/tasks/main.yml | 2 +- roles/system/tasks/main.yml | 2 +- roles/virtualbox/tasks/main.yml | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/inventory/host_vars/self.yml b/inventory/host_vars/self.yml index f11b2ac..f9627e4 100644 --- a/inventory/host_vars/self.yml +++ b/inventory/host_vars/self.yml @@ -1,3 +1,4 @@ +distribution_release: jammy first_name: Pim last_name: Kunis full_name: "{{ first_name }} {{ last_name }}" diff --git a/roles/alacritty/tasks/main.yml b/roles/alacritty/tasks/main.yml index 7d4d75f..3485b4f 100644 --- a/roles/alacritty/tasks/main.yml +++ b/roles/alacritty/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install PPA repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/alacritty.gpg] https://ppa.launchpadcontent.net/aslatter/ppa/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/alacritty.gpg] https://ppa.launchpadcontent.net/aslatter/ppa/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/neovim/tasks/main.yml b/roles/neovim/tasks/main.yml index 9f4839f..1611660 100644 --- a/roles/neovim/tasks/main.yml +++ b/roles/neovim/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install Neovim PPA become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/neovim.gpg] https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/neovim.gpg] https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/nicotine/tasks/main.yml b/roles/nicotine/tasks/main.yml index 63ec49a..18063b8 100644 --- a/roles/nicotine/tasks/main.yml +++ b/roles/nicotine/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install PPA repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/nicotine.gpg] https://ppa.launchpadcontent.net/nicotine-team/stable/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/nicotine.gpg] https://ppa.launchpadcontent.net/nicotine-team/stable/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/strawberry/tasks/main.yml b/roles/strawberry/tasks/main.yml index 04c8956..857cc1b 100644 --- a/roles/strawberry/tasks/main.yml +++ b/roles/strawberry/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install PPA repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/strawberry.gpg] https://ppa.launchpadcontent.net/jonaski/strawberry/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/strawberry.gpg] https://ppa.launchpadcontent.net/jonaski/strawberry/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index f3a846d..16ba0d6 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -40,7 +40,7 @@ - name: Install Hashicorp repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/hashicorp.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/hashicorp.gpg] https://apt.releases.hashicorp.com {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/virtualbox/tasks/main.yml b/roles/virtualbox/tasks/main.yml index b49c81b..a0ca488 100644 --- a/roles/virtualbox/tasks/main.yml +++ b/roles/virtualbox/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install VirtualBox APT repository become: true apt_repository: - repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/oracle_vbox_2016.asc] https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib" + repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/oracle_vbox_2016.asc] https://download.virtualbox.org/virtualbox/debian {{ distribution_release }} contrib" register: apt_repository tags: update - name: Update APT cache -- 2.45.2 From 05dc6f1f7eec4df0723725bb70056ceff558181b Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Mon, 20 Feb 2023 22:39:24 +0100 Subject: [PATCH 4/9] add ~/.local/bin to PATH --- roles/bash/files/bashrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/bash/files/bashrc b/roles/bash/files/bashrc index 04dcfbd..3b11a1e 100644 --- a/roles/bash/files/bashrc +++ b/roles/bash/files/bashrc @@ -100,3 +100,6 @@ alias vim='nvim' # asdf [ -f ~/.asdf/asdf.sh ] && source ~/.asdf/asdf.sh [ -f ~/.asdf/completions/asdf.bash ] && source ~/.asdf/completions/asdf.bash + +# pip scripts +PATH=$PATH:~/.local/bin -- 2.45.2 From d342dc674f5c3dd68c6c9406f83f591521200aee Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Mon, 20 Feb 2023 23:12:23 +0100 Subject: [PATCH 5/9] fix os3 setup --- README.md | 11 +++-------- playbooks/laptop.yml | 2 ++ roles/system/files/Xresources | 5 +++++ roles/system/tasks/main.yml | 5 +++++ 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 roles/system/files/Xresources diff --git a/README.md b/README.md index 9d2e35f..d16a272 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Personal Linux Setup -My current setup is [Regolith OS](https://regolith-desktop.com/) which is basically Ubuntu + i3. +My current setup is [Linux Mint Vera](https://linuxmint.com/edition.php?id=302) with the [i3 window manager](https://i3wm.org/). ## Before installing -- Put asymmetric key pair in ~/.ssh -- Install git +- Put Ansible Vault password in .vault_password +- Install git and curl - Install Ansible: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html ## TODO @@ -29,8 +29,3 @@ As an intermediate solution, I can just put the password in keepass... - More cool plugins :) - dropdown autocomplete - https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#yamlls - -## Long-term TODO - -- Move away from GNOME because it is quite slow and configuration is pretty bad. This would also mean moving away from Regolith unfortunately. I would probably move to KDE with i3. Maybe there is some distro that does this OOTB? -- Move away from systemd. Not sure how feasibly that is nowadays, but I just get annoyed by some systemd "features" such as resolved. diff --git a/playbooks/laptop.yml b/playbooks/laptop.yml index f0a0d0f..658851f 100644 --- a/playbooks/laptop.yml +++ b/playbooks/laptop.yml @@ -3,6 +3,8 @@ roles: - role: system tags: [system] + - role: i3 + tags: [i3] - role: bash tags: [bash] - role: alacritty diff --git a/roles/system/files/Xresources b/roles/system/files/Xresources new file mode 100644 index 0000000..7c3ddfb --- /dev/null +++ b/roles/system/files/Xresources @@ -0,0 +1,5 @@ +i3-wm.binding.split_h: c +i3-wm.binding.launcher.app: d + +i3-wm.binding.display: F1 +i3-wm.binding.settings: F2 diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index 16ba0d6..12d99ad 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -19,6 +19,11 @@ template: src: "{{ role_path }}/templates/.gitconfig.j2" dest: ~/.gitconfig +- name: Copy Xresources + copy: + src: "{{ role_path }}/files/Xresources" + dest: ~/.config/regolith2/Xresources + when: ansible_distribution == "Ubuntu" - name: Create keepassxc config directory file: path: ~/.config/keepassxc -- 2.45.2 From 61b7b05944d1d3d7e567230580f0abd07158b382 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Mon, 20 Feb 2023 23:29:17 +0100 Subject: [PATCH 6/9] also install i3 on os3 desktop --- playbooks/os3.yml | 2 ++ roles/system/files/Xresources | 5 ----- roles/system/tasks/main.yml | 5 ----- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 roles/system/files/Xresources diff --git a/playbooks/os3.yml b/playbooks/os3.yml index 69068c9..91f0a2a 100644 --- a/playbooks/os3.yml +++ b/playbooks/os3.yml @@ -3,6 +3,8 @@ roles: - role: system tags: [system] + - role: i3 + tags: [i3] - role: bash tags: [bash] - role: alacritty diff --git a/roles/system/files/Xresources b/roles/system/files/Xresources deleted file mode 100644 index 7c3ddfb..0000000 --- a/roles/system/files/Xresources +++ /dev/null @@ -1,5 +0,0 @@ -i3-wm.binding.split_h: c -i3-wm.binding.launcher.app: d - -i3-wm.binding.display: F1 -i3-wm.binding.settings: F2 diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index 12d99ad..16ba0d6 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -19,11 +19,6 @@ template: src: "{{ role_path }}/templates/.gitconfig.j2" dest: ~/.gitconfig -- name: Copy Xresources - copy: - src: "{{ role_path }}/files/Xresources" - dest: ~/.config/regolith2/Xresources - when: ansible_distribution == "Ubuntu" - name: Create keepassxc config directory file: path: ~/.config/keepassxc -- 2.45.2 From 3b60b2e09c46fe1b9271d61ba07cb1981941d91d Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Wed, 22 Feb 2023 22:04:05 +0100 Subject: [PATCH 7/9] add ssh-agent service --- inventory/host_vars/self.yml | 1 + playbooks/laptop.yml | 10 +++++---- playbooks/os3.yml | 10 +++++---- roles/bash/tasks/main.yml | 4 ++-- .../{files/bashrc => templates/bashrc.j2} | 2 ++ .../{system => keepassxc}/files/keepassxc.ini | 0 roles/keepassxc/tasks/main.yml | 22 +++++++++++++++++++ roles/system/files/ssh_config | 2 ++ roles/system/tasks/main.yml | 18 ++++++++------- roles/system/templates/ssh-agent.service.j2 | 10 +++++++++ 10 files changed, 61 insertions(+), 18 deletions(-) rename roles/bash/{files/bashrc => templates/bashrc.j2} (98%) rename roles/{system => keepassxc}/files/keepassxc.ini (100%) create mode 100644 roles/keepassxc/tasks/main.yml create mode 100644 roles/system/templates/ssh-agent.service.j2 diff --git a/inventory/host_vars/self.yml b/inventory/host_vars/self.yml index f9627e4..827f31f 100644 --- a/inventory/host_vars/self.yml +++ b/inventory/host_vars/self.yml @@ -5,3 +5,4 @@ full_name: "{{ first_name }} {{ last_name }}" email: pim@kunis.nl vscodium_extensions: - shd101wyy.markdown-preview-enhanced +ssh_agent_socket: /tmp/ssh-agent.socket diff --git a/playbooks/laptop.yml b/playbooks/laptop.yml index 658851f..df8979c 100644 --- a/playbooks/laptop.yml +++ b/playbooks/laptop.yml @@ -9,6 +9,12 @@ tags: [bash] - role: alacritty tags: [alacritty] + - role: syncthing + tags: [syncthing] + vars: + syncthing_profile: "laptop" + - role: keepassxc + tags: [keepassxc] - role: wireguard tags: [wireguard] - role: asdf @@ -21,10 +27,6 @@ tags: [virtualbox] - role: vscodium tags: [vscodium] - - role: syncthing - tags: [syncthing] - vars: - syncthing_profile: "laptop" - role: strawberry tags: [strawberry] - role: nicotine diff --git a/playbooks/os3.yml b/playbooks/os3.yml index 91f0a2a..7548860 100644 --- a/playbooks/os3.yml +++ b/playbooks/os3.yml @@ -9,13 +9,15 @@ tags: [bash] - role: alacritty tags: [alacritty] + - role: syncthing + tags: [syncthing] + vars: + syncthing_profile: "os3" + - role: keepassxc + tags: [keepassxc] - role: neovim tags: [neovim] - role: signal tags: [signal] - role: vscodium tags: [vscodium] - - role: syncthing - tags: [syncthing] - vars: - syncthing_profile: "os3" diff --git a/roles/bash/tasks/main.yml b/roles/bash/tasks/main.yml index 10cc1fe..5cad899 100644 --- a/roles/bash/tasks/main.yml +++ b/roles/bash/tasks/main.yml @@ -6,8 +6,8 @@ - bat - fzf - name: Install .bashrc - copy: - src: "{{ role_path }}/files/bashrc" + template: + src: "{{ role_path }}/templates/bashrc.j2" dest: ~/.bashrc - name: Install .fzf.bash copy: diff --git a/roles/bash/files/bashrc b/roles/bash/templates/bashrc.j2 similarity index 98% rename from roles/bash/files/bashrc rename to roles/bash/templates/bashrc.j2 index 3b11a1e..91d73a2 100644 --- a/roles/bash/files/bashrc +++ b/roles/bash/templates/bashrc.j2 @@ -103,3 +103,5 @@ alias vim='nvim' # pip scripts PATH=$PATH:~/.local/bin + +export SSH_AUTH_SOCK="{{ ssh_agent_socket }}" diff --git a/roles/system/files/keepassxc.ini b/roles/keepassxc/files/keepassxc.ini similarity index 100% rename from roles/system/files/keepassxc.ini rename to roles/keepassxc/files/keepassxc.ini diff --git a/roles/keepassxc/tasks/main.yml b/roles/keepassxc/tasks/main.yml new file mode 100644 index 0000000..f0dfa5b --- /dev/null +++ b/roles/keepassxc/tasks/main.yml @@ -0,0 +1,22 @@ +- name: Install Keepassxc + become: true + apt: + name: keepassxc +- name: Create keepassxc config directory + file: + path: ~/.config/keepassxc + state: directory +- name: Copy keepassxc.ini + copy: + src: "{{ role_path }}/files/keepassxc.ini" + dest: ~/.config/keepassxc/keepassxc.ini +- name: Create cache directory + file: + path: ~/.cache/keepassxc + state: directory + recurse: true +- name: Set SSH_AUTH_SOCK override + ini_file: + path: ~/.cache/keepassxc/keepassxc.ini + section: SSHAgent + value: "{{ ssh_agent_socket }}" diff --git a/roles/system/files/ssh_config b/roles/system/files/ssh_config index 24ccf45..2e513ae 100644 --- a/roles/system/files/ssh_config +++ b/roles/system/files/ssh_config @@ -1,3 +1,5 @@ +AddKeysToAgent yes + Host brussels HostName brussels.studlab.os3.nl User pkunis diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index 16ba0d6..90babc7 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -19,14 +19,6 @@ template: src: "{{ role_path }}/templates/.gitconfig.j2" dest: ~/.gitconfig -- name: Create keepassxc config directory - file: - path: ~/.config/keepassxc - state: directory -- name: Copy keepassxc.ini - copy: - src: "{{ role_path }}/files/keepassxc.ini" - dest: ~/.config/keepassxc/keepassxc.ini - name: Create repos directory file: path: ~/repos @@ -57,3 +49,13 @@ src: "{{ role_path }}/files/ssh_config" dest: ~/.ssh/config mode: 0600 +- name: Copy systemd ssh-agent service + template: + src: "{{ role_path }}/templates/ssh-agent.service.j2" + dest: /etc/systemd/user/ssh-agent.service +- name: Enable ssh-agent service + systemd: + name: ssh-agent + enabled: true + scope: user + state: started diff --git a/roles/system/templates/ssh-agent.service.j2 b/roles/system/templates/ssh-agent.service.j2 new file mode 100644 index 0000000..266e412 --- /dev/null +++ b/roles/system/templates/ssh-agent.service.j2 @@ -0,0 +1,10 @@ +[Unit] +Description=SSH key agent + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK={{ ssh_agent_socket }} +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK + +[Install] +WantedBy=default.target -- 2.45.2 From 3df5cc97c2f7ee2b3228f0cfac124b263c134f93 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Wed, 22 Feb 2023 22:09:10 +0100 Subject: [PATCH 8/9] fix keepassxc ssh agent socket option --- roles/keepassxc/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/keepassxc/tasks/main.yml b/roles/keepassxc/tasks/main.yml index f0dfa5b..6ef3c40 100644 --- a/roles/keepassxc/tasks/main.yml +++ b/roles/keepassxc/tasks/main.yml @@ -19,4 +19,5 @@ ini_file: path: ~/.cache/keepassxc/keepassxc.ini section: SSHAgent + option: AuthSockOverride value: "{{ ssh_agent_socket }}" -- 2.45.2 From f54d7c6ae129fbd25070d40f9eaa4f0d30e6ff3c Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Wed, 22 Feb 2023 23:52:51 +0100 Subject: [PATCH 9/9] small fixes --- roles/system/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index 90babc7..f400174 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -4,7 +4,6 @@ pkg: - git - make - - keepassxc - ripgrep - curl - unzip @@ -50,6 +49,7 @@ dest: ~/.ssh/config mode: 0600 - name: Copy systemd ssh-agent service + become: true template: src: "{{ role_path }}/templates/ssh-agent.service.j2" dest: /etc/systemd/user/ssh-agent.service -- 2.45.2