Add systemd service setup

This commit is contained in:
Sonny Bakker 2020-11-29 17:28:23 +01:00
parent e64c4a9879
commit 4aa78f0c48
8 changed files with 79 additions and 1 deletions

View file

@ -1,3 +1,5 @@
xdg_config_dir: "{{ ansible_env.HOME }}/.config"
packages:
- firefox
- mpv

16
roles/arch/files/tmux_start Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
MAIN="main"
DEVELOPMENT="development"
tmux start-server
tmux new-session -ds $MAIN
tmux new-window
tmux new-window
tmux select-window -t 0
tmux new-session -ds $DEVELOPMENT
tmux new-window
tmux new-window
tmux new-window
tmux select-window -t 0

View file

@ -28,3 +28,11 @@
name: openvpn-client@zeus
state: restarted
enabled: yes
- name: restart user ssh-agent
systemd:
name: ssh-agent
state: restarted
enabled: yes
daemon-reload: yes
scope: user

0
roles/arch/tasks/gpg.yml Normal file
View file

View file

@ -28,11 +28,13 @@
# - pacman setup depending on platform (see include section for common options)
# - laptop power saving configuration
- include_tasks: systemd.yml
- include_tasks: gpg.yml # TODO
- include_tasks: git.yml # TODO
- include_tasks: mpv.yml
- include_tasks: mpd.yml # TODO
- include_tasks: nfs.yml # TODO
- include_tasks: postgres.yml # TODO
- include_tasks: syncthing.yml # TODO depending on platform
- include_tasks: git.yml # TODO (identify)
- include_tasks: openvpn.yml # TODO (laptop)
- include_tasks: timer.yml

View file

@ -0,0 +1,25 @@
- name: setup systemd user service folder
file:
path: "{{ xdg_config_dir }}/systemd/user"
state: directory
mode: "0755"
- name: add ssh-agent service
template:
src: "ssh-agent.j2"
dest: "{{ xdg_config_dir }}/systemd/user/ssh-agent.service"
mode: "0644"
notify: restart user ssh-agent
- name: copy tmux service
template:
src: "tmux.j2"
dest: "{{ xdg_config_dir }}/systemd/user/tmux.service"
mode: "0644"
- name: copy tmux startup script
copy:
src: "tmux_start"
dest: "{{ ansible_env.HOME }}/.local/bin/tmux_start"
mode: "0740"
force: false

View file

@ -0,0 +1,12 @@
# {{ ansible_managed }} {{ ansible_date_time.time }} {{ ansible_date_time.date }}
[Unit]
Description=SSH key agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
[Install]
WantedBy=default.target

View file

@ -0,0 +1,13 @@
# {{ ansible_managed }} {{ ansible_date_time.time }} {{ ansible_date_time.date }}
[Unit]
Description=Tmux startup script
[Service]
Environment=DISPLAY=:0
ExecStart=/home/sonny/.local/bin/tmux_start
Type=forking
RemainAfterExit=yes
[Install]
WantedBy=default.target