diff --git a/README.md b/README.md index 83d88cc..9cbe6b9 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/tasks/main.yml b/tasks/main.yml index e610e93..9c20454 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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'] @@ -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']