Role Name
With this autofs role, autofs_2
can be configured NFS, CIFS and bindmounts mounts. SSHFS is still (2023/10) under development ...
Requirements
No special ...
Role Variables
Name | Type | Default value | Purpose | Comment | Role |
---|---|---|---|---|---|
autofs_2_use_autofs | Boolean | false | central variable to activate the role | - | autofs_2 |
autofs_2_use_autofs_cifs | Boolean | false | enable CIFS mounts | - | autofs_2 |
autofs_2_use_autofs_nfs | Boolean | false | enable NFS mounts | - | autofs_2 |
autofs_2_use_autofs_sshfs | Boolean | false | enable SSHFS mounts | - | autofs_2 |
autofs_2_use_autofs_bindmount | Boolean | false | enable local bindmount mounts | - | autofs_2 |
Variable | What is meant |
---|---|
mount_target | this means the directory into the mount_point is mounted |
mount_point | the mount point name which should be mounted |
mount_options | all mount options |
mount_comment | a comment if desired |
mount_map_file | if an own mapfile is to be used, otherwise the default is taken |
remote_server | the remote server, this can be a FQDN or an IPv4 address |
remote_directory | the remote directory |
autofs_options | autofs optionen |
default_auto_nfs_map_file | here the default file for NFS is configured |
default_auto_sshfs_map_file | here the default file for SSHFS is configured |
default_auto_bindmount_map_file | here the default file for bindmounts is configured |
default_auto_cifs_map_file | here the default file for CIFS is configured |
autofs_options | autofs specific options |
Example / How-to-use
The role can be configured via group_vars
or host_vars
. The role is switched on/off centrally via the variable autofs_2_use_autofs
. After that, variables can be used to activate which mounts should be used and these are then configured. See the examples below. The configuration files are configured in defaults/main.yml
.
CIFS
autofs_2_use_autofs_cifs: true
autofs_2_auto_mount_cifs:
- mount_target: "/<local-dir>/cifs"
mount_point: "<local-mount-point-name>"
mount_options: "-fstype=cifs,<all-cifs-specific-mount-options>"
mount_comment: "<mount-comment>"
mount_map_file: "{{ default_auto_cifs_map_file }}"
remote_server: "://<FQDN-or-IP>"
remote_directory: "<remote-share-name>"
autofs_options: "timeout=60 --ghost"
- remote_directory: has to start with ://
NFS
autofs_2_use_autofs_nfs: true
autofs_2_auto_mount_nfs:
- mount_target: "/<local-dir>/nfs"
mount_point: "<local-mount-point-name>"
mount_options: "-fstype=nfs,<all-nfs-specific-mount-options>"
mount_comment: "<mount-comment>"
mount_map_file: "{{ default_auto_nfs_map_file }}"
remote_server: "<FQDN-or-IP>:"
remote_directory: "<remote-dir>/filme"
autofs_options: "--timeout=60 --ghost"
- remote_directory: must not be start with /
Bindmount
autofs_2_use_autofs_bindmount: true
autofs_2_auto_mount_localbind:
- mount_target: "/<local-dir>/localbbind"
mount_point: "<local-mount-point-name>"
mount_options: "-type=bind"
mount_comment: "<mount-comment>"
mount_map_file: "{{ default_auto_bindmount_map_file }}"
remote_server: "bindmount"
remote_directory: ":/tmp"
autofs_options: "--timeout=60 --ghost"
- remote_server: must be bindmount !! Because of we have no remote-server !!
- remote_directory: has to start with : !! Because it is the local source !!
SSHFS
Is not ready yet. We are working on it.
Dependencies
None ...
Notes
Debugging
If you have problems, you can turn on the autofs
debugging.
/etc/default/autofs
OPTIONS="--debug"
Or stop autofs
... and run automount
in the foreground with verbose information
systemctl stop autofs
automount -f -v
vars
The file vars/main.yml
is only used as an example and should not be used.
Example Playbook
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
BSD
Author Information
Author: Christian Schneider christian.schneider@id.ethz.ch Maintainer: ID Product Center - Linux Client