From 9fbedc9e5bc0d712ac374505f2ff7fd078ed899f Mon Sep 17 00:00:00 2001 From: tolerryan <105945216+tolerryan@users.noreply.github.com> Date: Sun, 27 Oct 2024 01:36:30 -0500 Subject: [PATCH] add service file --- roles/ind/wikmd/wikmd-install.yml | 35 +++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/roles/ind/wikmd/wikmd-install.yml b/roles/ind/wikmd/wikmd-install.yml index b62bb16..18ea44b 100644 --- a/roles/ind/wikmd/wikmd-install.yml +++ b/roles/ind/wikmd/wikmd-install.yml @@ -74,9 +74,26 @@ state: present update_cache: yes - - name: setup service - - name: start server, should be afte restore below - - name: + - name: Setup Service + copy: + dest: /etc/systemd/system/wikmd.service + content: | + [Unit] + Description=Wikmd + After=network.target + + [Service] + User= + WorkingDirectory=/data/wikmd + ExecStart=StartWikmd.sh + Restart=always + + [Install] + WantedBy=multi-user.target + owner: root + group: root + mode: '0644' + # docker image is broken using manual install method #- name: Write docker-compose.yml # ansible.builtin.copy: @@ -95,4 +112,14 @@ command: restic --password-file ./.resticpassword -r sftp:misamisa://home/restic/$(hostname) --target /data/wikmd restore latest args: chdir: /home/restic - creates: /data/wikmd \ No newline at end of file + creates: /data/wikmd + + - name: Reload systemd daemon + systemd: + daemon_reload: yes + + - name: Start Wikmd Service + systemd: + name: wikmd + state: started + enabled: yes \ No newline at end of file