Skip to content

Commit

Permalink
Merge pull request #13 from MiLk/fixes/user-per-disk
Browse files Browse the repository at this point in the history
Configure the user and group per disk
  • Loading branch information
MiLk authored Mar 13, 2017
2 parents 721f2a4 + 25607bd commit 382adef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ disk_additional_disks:
fstype: ext4
mount_options: defaults
mount: /data
user: www-data
group: www-data
```
* `disk` is the device, you want to mount.
* `fstype` allows you to choose the filesystem to use with the new disk.
* `mount_options` allows you to specify custom mount options.
* `mount` is the directory where the new disk should be mounted.
* `user` sets owner of the mount directory (default: `root`).
* `group` sets group of the mount directory (default: `root`).

You can add:
* `disk_user` sets owner of the mount directory (default: root)
* `disk_group` sets group of the mount directory (default: root)
* `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.

The following filesystems are currently supported:
Expand Down
13 changes: 11 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
- name: "Ensure the mount directory exists"
file:
path: '{{ item.mount }}'
owner: '{{ disk_user | default("root") }}'
group: '{{ disk_group | default("root") }}'
owner: '{{ item.user | default("root") }}'
group: '{{ item.group | default("root") }}'
state: directory
with_items: '{{ disk_additional_disks }}'
tags: ['disk']
Expand All @@ -56,3 +56,12 @@
- '{{ disk_additional_disks }}'
- '{{ disk_blkid.results }}'
tags: ['disk']

- name: "Ensure the permissions are set correctly"
file:
path: '{{ item.mount }}'
owner: '{{ item.user | default("root") }}'
group: '{{ item.group | default("root") }}'
state: directory
with_items: '{{ disk_additional_disks }}'
tags: ['disk']

0 comments on commit 382adef

Please sign in to comment.