|
@@ -16,20 +16,17 @@
|
16
|
16
|
- name: Add main user to fuse group
|
17
|
17
|
user: name={{ main_user_name }} append=yes groups=fuse
|
18
|
18
|
|
19
|
|
-# Check if the /encrypted directory is empty
|
20
|
|
-- name: Check for existing encfs
|
|
19
|
+- name: Check if the /encrypted directory is empty
|
21
|
20
|
shell: ls /encrypted/*
|
22
|
21
|
ignore_errors: True
|
23
|
22
|
changed_when: False # never report as "changed"
|
24
|
23
|
register: encfs_check
|
25
|
24
|
|
26
|
|
-# If it is empty, we need to create the encfs
|
27
|
|
-- name: Create encfs
|
|
25
|
+- name: If /encrypted is empty, create the encfs there
|
28
|
26
|
shell: printf "p\n{{ encfs_password }}" | encfs /encrypted /decrypted --public --stdinpass && touch /decrypted/test
|
29
|
27
|
when: encfs_check.rc > 0
|
30
|
28
|
|
31
|
|
-# If it isn't empty, we simply need to mount it (but only if /decrypted/test doesn't exist)
|
32
|
|
-- name: Mount encfs
|
|
29
|
+- name: If /encrypted isn't empty, mount it (but only if /decrypted/test doesn't exist)
|
33
|
30
|
shell: printf "{{ encfs_password }}" | encfs /encrypted /decrypted --public --stdinpass creates="/decrypted/test"
|
34
|
31
|
when: encfs_check.rc == 0
|
35
|
32
|
|