From 44355d99e5fa9316e8f537cb8a0a2bf9f1f1680e Mon Sep 17 00:00:00 2001
From: binary <me@rgoncalves.se>
Date: Wed, 16 Dec 2020 22:15:16 +0100
Subject: Use more variables for stagit role

---
 roles/stagit/tasks/main.yml | 12 ++++++------
 roles/stagit/vars/main.yml  | 10 ++++++++++
 2 files changed, 16 insertions(+), 6 deletions(-)
 create mode 100644 roles/stagit/vars/main.yml

diff --git a/roles/stagit/tasks/main.yml b/roles/stagit/tasks/main.yml
index 33a26be..e8fd41d 100644
--- a/roles/stagit/tasks/main.yml
+++ b/roles/stagit/tasks/main.yml
@@ -11,7 +11,7 @@
 
 - name: create stagit static-files directory
   file:
-    path: /var/www/htdocs/stagit
+    path: "{{ stagit_htmldir }}"
     state: directory
     owner: www
     group: daemon
@@ -20,7 +20,7 @@
 - name: copy static-page generation script
   copy:
     src: generate-static-git.sh
-    dest: /var/www/htdocs/stagit
+    dest: "{{ stagit_htmldir }}"
     owner: www
     group: "{{ group_root }}"
     mode: 0744
@@ -28,7 +28,7 @@
 - name: copy stagit stylesheet
   copy:
     src: style.css
-    dest: /var/www/htdocs/stagit
+    dest: "{{ stagit_htmldir }}"
     owner: www
     group: "{{ group_root }}"
     mode: 0644
@@ -47,7 +47,7 @@
 - name: download default website logo
   get_url:
     url: http://rgoncalves.se/logo.png
-    dest: /var/www/htdocs/stagit/logo.png
+    dest: "{{ stagit_htmldir }}/logo.png"
     owner: www
     group: "{{ group_root }}"
     mode: 0644
@@ -57,9 +57,9 @@
   cron:
     name: "Static git-page generation"
     minute: "*/5"
-    job: "cd /var/www/htdocs/stagit && ./generate-static-git.sh >/dev/null 2>&1"
+    job: "cd {{ stagit_htmldir }} && ./generate-static-git.sh >/dev/null 2>&1"
 
 - name: execute static-page generation script once
   shell: ./generate-static-git.sh
   args:
-    chdir: /var/www/htdocs/stagit
+    chdir: "{{ stagit_htmldir }}"
diff --git a/roles/stagit/vars/main.yml b/roles/stagit/vars/main.yml
new file mode 100644
index 0000000..a33cccf
--- /dev/null
+++ b/roles/stagit/vars/main.yml
@@ -0,0 +1,10 @@
+
+# git ~~ roles/git/tasks/vars.yml
+# default vars for git role
+
+---
+
+stagit_user: "git"
+stagit_group: "git"
+stagit_dir: "/data/git/"
+stagit_htmldir: "/var/www/htocs/stagit/"
-- 
cgit v1.2.3