Fixed writefreely role.
authorLuke Hoersten <luke@hoersten.org>
Sat, 24 Jul 2021 17:55:23 -0500
changeset 171 534b247bed1c
parent 170 a20a6d03747f
child 172 21cfe5ba8d13
Fixed writefreely role.
writefreely/server/handlers/main.yaml
writefreely/server/tasks/main.yaml
--- a/writefreely/server/handlers/main.yaml	Sat Jul 24 10:29:53 2021 -0500
+++ b/writefreely/server/handlers/main.yaml	Sat Jul 24 17:55:23 2021 -0500
@@ -4,6 +4,10 @@
   become: yes
   systemd: name="writefreely@{{writefreely_instance}}.service" enabled="yes" daemon_reload="yes"
 
+- name: restart service
+  become: yes
+  systemd: name="writefreely@{{writefreely_instance}}.service" state="restarted" enabled="yes" daemon_reload="yes"
+
 - name: migrate db
   become: yes
   become_user: "{{writefreely_user}}"
--- a/writefreely/server/tasks/main.yaml	Sat Jul 24 10:29:53 2021 -0500
+++ b/writefreely/server/tasks/main.yaml	Sat Jul 24 17:55:23 2021 -0500
@@ -23,7 +23,9 @@
     owner: "root"
     group: "root"
     mode: "0755"
-  notify: migrate db
+  notify:
+    - migrate db
+    - restart service
 
 - name: create instance dir
   become: yes
@@ -33,7 +35,7 @@
     owner: "{{writefreely_user}}"
     group: "{{writefreely_user}}"
     mode: "0755"
-  notify: reload service
+  notify: restart service
   loop:
     - "{{writefreely_dir}}"
     - "{{writefreely_dir}}/{{writefreely_instance}}"
@@ -47,6 +49,7 @@
     owner: "{{writefreely_user}}"
     group: "{{writefreely_user}}"
     mode: "0755"
+  notify: restart service
 
 - name: configure
   become: yes
@@ -56,12 +59,7 @@
     mode: "0644"
     owner: "{{writefreely_user}}"
     group: "{{writefreely_user}}"
-  notify: reload service
-
-- name: check if keys exists
-  stat:
-    path: "{{writefreely_dir}}/{{writefreely_instance}}/keys/cookies_auth.aes256"
-  register: keys_file
+  notify: restart service
 
 - name: generate keys
   become: yes
@@ -69,7 +67,7 @@
   command: "writefreely keys generate"
   args:
     chdir: "{{writefreely_dir}}/{{writefreely_instance}}/"
-  # when: not keys_file.stat.exists
+  chaned_when: false
 
 - name: check if db exists
   stat:
@@ -97,6 +95,7 @@
   template:
     src: "[email protected]"
     dest: "/lib/systemd/system/[email protected]"
+  notify: reload service
 
 - name: ensure service is started
   become: yes