From 21602e050cb87d4b44fa25638e28792dee947619 Mon Sep 17 00:00:00 2001
From: Chris Croome <chris@webarchitects.co.uk>
Date: Mon, 8 May 2017 22:13:01 +0100
Subject: [PATCH] tweaks

---
 roles/discourse/tasks/main.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/roles/discourse/tasks/main.yml b/roles/discourse/tasks/main.yml
index d334b1a..e66a005 100644
--- a/roles/discourse/tasks/main.yml
+++ b/roles/discourse/tasks/main.yml
@@ -17,6 +17,20 @@
     groups: discourse,docker
     uid: 1000
 
+- name: Stat /var/discourse/lost+found
+  stat:
+    path: "/var/discourse/lost+found"
+  register: var_discourse_partition
+
+- block:
+
+  - name: Delete lost+found directory if /var/discourse is a partition 
+    file:
+      dest: /var/discourse/lost+found
+      state: absent
+
+  when: var_discourse_partition.stat.exists == True
+
 - name: Directory for Discourse present
   file:
     dest: /var/discourse
@@ -86,6 +100,16 @@
   become: yes
   become_user: 'discourse' 
 
+- block:
+
+  - name: Create lost+found directory 
+    command: mklost+found
+    args:
+      chdir: /var/discourse
+      creates: /var/discourse/lost+found
+
+  when: var_discourse_partition.stat.exists == True
+
 - name: Count how much swap is available
   shell: "free -g --si | awk '/^Swap:/{print $2}'"
   args:
-- 
GitLab