From c52acd408d202c95d171588024404a7f4cc598bf Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 17 Aug 2016 21:30:13 +0300
Subject: [PATCH] - Removed hardcoded Docker graph directory values.

---
 templates/docker.service.d_Assertions.conf.j2 | 4 ++--
 workstation.yml                               | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/templates/docker.service.d_Assertions.conf.j2 b/templates/docker.service.d_Assertions.conf.j2
index 598b709..2d58df4 100644
--- a/templates/docker.service.d_Assertions.conf.j2
+++ b/templates/docker.service.d_Assertions.conf.j2
@@ -1,4 +1,4 @@
 [Unit]
-After=home-nimrod.mount
-AssertPathIsMountPoint={{ docker_graph_mount }}
+After=home-{{ ansible_env.SUDO_USER }}.mount
+AssertPathIsMountPoint={{  docker_graph_df.stdout_lines.1.split().5 }}
 AssertPathIsDirectory={{ docker_graph_directory }}
diff --git a/workstation.yml b/workstation.yml
index 3a77470..281e0be 100644
--- a/workstation.yml
+++ b/workstation.yml
@@ -3,8 +3,7 @@
   become: yes
   become_user: root
   vars:
-      docker_graph_mount: '/home/{{ ansible_env.SUDO_USER }}'
-      docker_graph_directory: '{{ docker_graph_mount }}/.bind_mounts/docker'
+      docker_graph_directory: '/home/{{ ansible_env.SUDO_USER }}/.bind_mounts/docker'
   handlers:
   - name: Systemd daemon reload
     command: /bin/systemctl daemon-reload
@@ -71,6 +70,11 @@
     notify:
     - Restart Docker
 
+  - name: Get Docker graph directory mountpoint
+    shell: df {{ docker_graph_directory }}
+    register: docker_graph_df
+    changed_when: False
+
   - name: Create Systemd configuration override directories
     with_items:
     - docker.service
-- 
GitLab