Skip to content

Commit 382adef

Browse files
authored
Merge pull request #13 from MiLk/fixes/user-per-disk
Configure the user and group per disk
2 parents 721f2a4 + 25607bd commit 382adef

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ disk_additional_disks:
2020
fstype: ext4
2121
mount_options: defaults
2222
mount: /data
23+
user: www-data
24+
group: www-data
2325
```
2426
2527
* `disk` is the device, you want to mount.
2628
* `fstype` allows you to choose the filesystem to use with the new disk.
2729
* `mount_options` allows you to specify custom mount options.
2830
* `mount` is the directory where the new disk should be mounted.
31+
* `user` sets owner of the mount directory (default: `root`).
32+
* `group` sets group of the mount directory (default: `root`).
2933

3034
You can add:
31-
* `disk_user` sets owner of the mount directory (default: root)
32-
* `disk_group` sets group of the mount directory (default: root)
3335
* `disk_package_use` is the required package manager module to use (yum, apt, etc). The default 'auto' will use existing facts or try to autodetect it.
3436

3537
The following filesystems are currently supported:

tasks/main.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
- name: "Ensure the mount directory exists"
3232
file:
3333
path: '{{ item.mount }}'
34-
owner: '{{ disk_user | default("root") }}'
35-
group: '{{ disk_group | default("root") }}'
34+
owner: '{{ item.user | default("root") }}'
35+
group: '{{ item.group | default("root") }}'
3636
state: directory
3737
with_items: '{{ disk_additional_disks }}'
3838
tags: ['disk']
@@ -56,3 +56,12 @@
5656
- '{{ disk_additional_disks }}'
5757
- '{{ disk_blkid.results }}'
5858
tags: ['disk']
59+
60+
- name: "Ensure the permissions are set correctly"
61+
file:
62+
path: '{{ item.mount }}'
63+
owner: '{{ item.user | default("root") }}'
64+
group: '{{ item.group | default("root") }}'
65+
state: directory
66+
with_items: '{{ disk_additional_disks }}'
67+
tags: ['disk']

0 commit comments

Comments
 (0)