2
0
Fork 0

Manage /etc/fstab entry.

This commit is contained in:
Jeremy Gardais 2017-07-21 15:20:07 +02:00
parent cf98265293
commit c95518aa1a
3 changed files with 17 additions and 0 deletions

View File

@ -16,6 +16,10 @@ Manage to mount local and remote devices.
* **mounts_list**: Directory that must contains all informations about devices to mount.
* **mounts_list.name**: The path to the mountpoint.
* **mounts_list.src**: Path to the local or remove device.
* **mounts_list.fstype**: Device filesystem type.
* **mounts_list.opts**: Mount options [default: `defaults,noatime`].
* **mounts_list.state**: If the device should be 'mounted', 'present',… [default: `present`].
## Example Playbook
@ -31,6 +35,8 @@ Manage to mount local and remote devices.
This role will:
* Create the mountpoint directory.
* Add an entry in `/etc/fstab`.
* Ensure to mount the device if specified.
## Development

View File

@ -7,3 +7,5 @@ mounts_list: []
# fstype: nfs4
# opts: 'defaults,x-systemd.automount,x-systemd.device-timeout=2,x-systemd.idle-timeout=1min,noatime,noauto'
# state: mounted
mounts_opts: 'defaults,noatime'
mounts_state: 'present'

View File

@ -6,3 +6,12 @@
path: "{{ item.name }}"
state: directory
with_items: "{{ mounts_list }}"
- name: Mount devices
mount:
name: "{{ item.name }}"
src: "{{ item.src }}"
fstype: "{{ item.fstype }}"
opts: "{{ item.opts | default(mounts_opts) }}"
state: "{{ item.state | default(mounts_state) }}"
with_items: "{{ mounts_list }}"