mirror of
https://github.com/pigmonkey/spark.git
synced 2026-01-23 10:25:39 +00:00
run git-annex as a user service
When this role was created, Ansible did not support sytemd user units,
so we setup git-annex as a system service running as the user. The only
practical difference in moving to a user service is that the user can
control the service without sudo, but we might as well.
Existing users should first stop, disable, and remove the old system
service:
$ sudo systemctl stop git-annex@$USER.service
$ sudo systemctl disable git-annex@$USER.service
$ sudo rm /etc/systemd/system/git-annex@.*
If the system service is present in the trusted unit file, remove it.
This commit is contained in:
parent
81b14e8868
commit
715480754f
2 changed files with 9 additions and 6 deletions
|
|
@ -1,10 +1,9 @@
|
|||
[Unit]
|
||||
Description=Git Annex Assistant Service for %I
|
||||
Description=Git Annex Assistant Service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/git-annex assistant --foreground --autostart
|
||||
User=%i
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
- aur
|
||||
|
||||
- name: Push git-annex assistant service file
|
||||
copy: src=git-annex.service dest=/etc/systemd/system/git-annex@.service
|
||||
copy: src=git-annex.service dest=/etc/systemd/user/git-annex.service
|
||||
notify:
|
||||
- reload systemd config
|
||||
- restart git-annex
|
||||
|
|
@ -18,19 +18,23 @@
|
|||
register: autostart
|
||||
|
||||
- name: Enable and start git-annex assistant service
|
||||
service: name="git-annex@{{ user.name }}.service" enabled=yes state=started
|
||||
systemd: name=git-annex.service user=yes enabled=yes state=started
|
||||
become: yes
|
||||
become_user: "{{ user.name }}"
|
||||
environment:
|
||||
XDG_RUNTIME_DIR: "/run/user/{{ user.uid }}"
|
||||
when: autostart.stat is defined and autostart.stat.size > 0
|
||||
|
||||
- name: Add git-annex to trusted unit list
|
||||
lineinfile: dest=/usr/local/etc/trusted_units
|
||||
state=present
|
||||
line="git-annex@{{ user.name }}.service,allow_offline"
|
||||
line="git-annex.service,user:{{ user.name }},allow_offline"
|
||||
when: gitannex.stop_on_untrusted is defined and gitannex.stop_on_untrusted == True
|
||||
|
||||
- name: Remove git-annex from trusted unit list
|
||||
lineinfile: dest=/usr/local/etc/trusted_units
|
||||
state=absent
|
||||
line="git-annex@{{ user.name }}.service,allow_offline"
|
||||
line="git-annex.service,user:{{ user.name }},allow_offline"
|
||||
when: gitannex.stop_on_untrusted is not defined or gitannex.stop_on_untrusted != True
|
||||
|
||||
- name: Increase the amount of inotify watchers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue