diff --git a/templates/seaf-daemon.service.j2 b/files/seaf-daemon.service similarity index 66% rename from templates/seaf-daemon.service.j2 rename to files/seaf-daemon.service index 37c9f99..1df19a9 100755 --- a/templates/seaf-daemon.service.j2 +++ b/files/seaf-daemon.service @@ -11,7 +11,7 @@ StartLimitBurst=3 [Service] Type=simple -ExecStart=/usr/bin/seaf-daemon -c {{ seafile_local_user_info.home }}/.ccnet -d {{ seafile_local_user_info.home }}/config/seafile-data -w {{ seafile_local_user_info.home }}/config/seafile +ExecStart=/usr/bin/seaf-daemon -c %h/.ccnet -d %h/config/seafile-data -w %h/config/seafile Restart=always RestartSec=10 # Restart every day diff --git a/tasks/main.yml b/tasks/main.yml index 78161c3..55bae0d 100755 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -20,15 +20,9 @@ - seafile-cli become: false # need to do this as root -- name: Register user info of {{ seafile_local_user.user }} - user: - name: "{{ seafile_local_user.user }}" - check_mode: true - register: seafile_local_user_info - - name: Define directory for Seafile mirror service as fact set_fact: - seafile_mirror_dir: "{{ seafile_local_user_info.home }}/seafile_mirror" + seafile_mirror_dir: "~/seafile_mirror" - name: Ensure directory for Seafile mirror service exists file: @@ -64,13 +58,13 @@ - name: Ensure Seafile config dir exists file: - path: "{{ seafile_local_user_info.home }}/config" + path: "~/config" state: directory mode: "0755" - name: Ensure Seafile config dir is initialised command: - cmd: seaf-cli init -d "{{ seafile_local_user_info.home }}/config" + cmd: seaf-cli init -d "~/config" register: result changed_when: '"already exists" not in result.stdout' @@ -82,3 +76,4 @@ vars: user: "{{ seafile_local_user.user }}" service: seaf-daemon + copy_file: seaf-daemon.service