Manage /etc/fstab entry.
This commit is contained in:
parent
cf98265293
commit
c95518aa1a
|
@ -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
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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 }}"
|
||||
|
|
Reference in New Issue