Add systemd service setup
This commit is contained in:
parent
e64c4a9879
commit
4aa78f0c48
8 changed files with 79 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
xdg_config_dir: "{{ ansible_env.HOME }}/.config"
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
- firefox
|
- firefox
|
||||||
- mpv
|
- mpv
|
||||||
|
|
|
||||||
16
roles/arch/files/tmux_start
Executable file
16
roles/arch/files/tmux_start
Executable 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
|
||||||
|
|
@ -28,3 +28,11 @@
|
||||||
name: openvpn-client@zeus
|
name: openvpn-client@zeus
|
||||||
state: restarted
|
state: restarted
|
||||||
enabled: yes
|
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
0
roles/arch/tasks/gpg.yml
Normal file
|
|
@ -28,11 +28,13 @@
|
||||||
# - pacman setup depending on platform (see include section for common options)
|
# - pacman setup depending on platform (see include section for common options)
|
||||||
# - laptop power saving configuration
|
# - laptop power saving configuration
|
||||||
|
|
||||||
|
- include_tasks: systemd.yml
|
||||||
|
- include_tasks: gpg.yml # TODO
|
||||||
|
- include_tasks: git.yml # TODO
|
||||||
- include_tasks: mpv.yml
|
- include_tasks: mpv.yml
|
||||||
- include_tasks: mpd.yml # TODO
|
- include_tasks: mpd.yml # TODO
|
||||||
- include_tasks: nfs.yml # TODO
|
- include_tasks: nfs.yml # TODO
|
||||||
- include_tasks: postgres.yml # TODO
|
- include_tasks: postgres.yml # TODO
|
||||||
- include_tasks: syncthing.yml # TODO depending on platform
|
- include_tasks: syncthing.yml # TODO depending on platform
|
||||||
- include_tasks: git.yml # TODO (identify)
|
|
||||||
- include_tasks: openvpn.yml # TODO (laptop)
|
- include_tasks: openvpn.yml # TODO (laptop)
|
||||||
- include_tasks: timer.yml
|
- include_tasks: timer.yml
|
||||||
|
|
|
||||||
25
roles/arch/tasks/systemd.yml
Normal file
25
roles/arch/tasks/systemd.yml
Normal 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
|
||||||
12
roles/arch/templates/ssh-agent.j2
Normal file
12
roles/arch/templates/ssh-agent.j2
Normal 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
|
||||||
13
roles/arch/templates/tmux.j2
Normal file
13
roles/arch/templates/tmux.j2
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue