diff --git a/README.md b/README.md index 2dc7cdd..8db383e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index 62a4fcd..fc7dd4e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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' diff --git a/tasks/main.yml b/tasks/main.yml index 9e8ca18..80599e0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 }}"