add ssh-agent service

This commit is contained in:
Pim Kunis 2023-02-22 22:04:05 +01:00 committed by Gitea
parent 0048372069
commit 401973a0bb
10 changed files with 61 additions and 18 deletions

View file

@ -5,3 +5,4 @@ full_name: "{{ first_name }} {{ last_name }}"
email: pim@kunis.nl email: pim@kunis.nl
vscodium_extensions: vscodium_extensions:
- shd101wyy.markdown-preview-enhanced - shd101wyy.markdown-preview-enhanced
ssh_agent_socket: /tmp/ssh-agent.socket

View file

@ -9,6 +9,12 @@
tags: [bash] tags: [bash]
- role: alacritty - role: alacritty
tags: [alacritty] tags: [alacritty]
- role: syncthing
tags: [syncthing]
vars:
syncthing_profile: "laptop"
- role: keepassxc
tags: [keepassxc]
- role: wireguard - role: wireguard
tags: [wireguard] tags: [wireguard]
- role: asdf - role: asdf
@ -21,10 +27,6 @@
tags: [virtualbox] tags: [virtualbox]
- role: vscodium - role: vscodium
tags: [vscodium] tags: [vscodium]
- role: syncthing
tags: [syncthing]
vars:
syncthing_profile: "laptop"
- role: strawberry - role: strawberry
tags: [strawberry] tags: [strawberry]
- role: nicotine - role: nicotine

View file

@ -9,13 +9,15 @@
tags: [bash] tags: [bash]
- role: alacritty - role: alacritty
tags: [alacritty] tags: [alacritty]
- role: syncthing
tags: [syncthing]
vars:
syncthing_profile: "os3"
- role: keepassxc
tags: [keepassxc]
- role: neovim - role: neovim
tags: [neovim] tags: [neovim]
- role: signal - role: signal
tags: [signal] tags: [signal]
- role: vscodium - role: vscodium
tags: [vscodium] tags: [vscodium]
- role: syncthing
tags: [syncthing]
vars:
syncthing_profile: "os3"

View file

@ -6,8 +6,8 @@
- bat - bat
- fzf - fzf
- name: Install .bashrc - name: Install .bashrc
copy: template:
src: "{{ role_path }}/files/bashrc" src: "{{ role_path }}/templates/bashrc.j2"
dest: ~/.bashrc dest: ~/.bashrc
- name: Install .fzf.bash - name: Install .fzf.bash
copy: copy:

View file

@ -103,3 +103,5 @@ alias vim='nvim'
# pip scripts # pip scripts
PATH=$PATH:~/.local/bin PATH=$PATH:~/.local/bin
export SSH_AUTH_SOCK="{{ ssh_agent_socket }}"

View file

@ -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 }}"

View file

@ -1,3 +1,5 @@
AddKeysToAgent yes
Host brussels Host brussels
HostName brussels.studlab.os3.nl HostName brussels.studlab.os3.nl
User pkunis User pkunis

View file

@ -19,14 +19,6 @@
template: template:
src: "{{ role_path }}/templates/.gitconfig.j2" src: "{{ role_path }}/templates/.gitconfig.j2"
dest: ~/.gitconfig 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 - name: Create repos directory
file: file:
path: ~/repos path: ~/repos
@ -57,3 +49,13 @@
src: "{{ role_path }}/files/ssh_config" src: "{{ role_path }}/files/ssh_config"
dest: ~/.ssh/config dest: ~/.ssh/config
mode: 0600 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

View file

@ -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