sedunne.autofs
Ansible AutoFS Role
This Ansible role installs autofs and manages the 'master' and 'map' files.
Requirements
- Ansible version 2.0 or higher
- sudo or root access
It has been tested on Linux but might work on other systems too.
Usage
After adding the role to your path, it will automatically set up the service. You can create masters and maps by providing the dictionaries shown below as variables.
Service Configuration
You can configure the service with the following options:
autofs_package_name: 'autofs'
- name of the package for autofsautofs_package_state: 'present'
- the desired package state; allows 'latest' or 'present'autofs_service_name: 'autofs'
- the name of the autofs serviceautofs_allow_browse: True
- if 'True' (default), enablesbrowse_mode
autofs_conf_file: '/etc/autofs.conf'
- location of the main configuration fileautofs_master_file: '/etc/auto.master'
- location of the main master fileautofs_dyn_dir: '/etc/auto.master.d'
- directory for dynamic configurations
Master Files
This role places master files in the autofs dynamic directory to avoid changes to the main 'auto.master' file. It will include:
+dir:/path/to/dynamic/directory
A backup is created by default, but you can turn this off with the autofs_create_master_backup
option.
To create master files, use the autofs_masters:
dictionary in this format:
autofs_masters:
auto.master.name1:
mount_point: /some/path
map_type: file
map_format: sun
map_name: name.map
options: 'option1 option2 option3'
auto.master.name2:
mount_point: /another/one
map_name: some.map
The master file will be named after each key and placed in the specified dynamic directory. You can adjust the user, group, and permissions with autofs_owner
, autofs_group
, and autofs_mode
options.
Map Files
To create map files, use the autofs_maps
dictionary in this format:
autofs_maps:
map.name:
path: /some/path
mounts:
- 'dir1 192.168.1.10:/export1'
- 'dir2 -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.20:/export2'
Map files will be created with the key as their name, in the specified path. Each list item corresponds to a line in the map file.
Known Issues
If you use the role without defining any master or map files, you'll receive this warning:
[DEPRECATION WARNING]: Skipping task due to undefined Error, in the future this will be a fatal error.: 'autofs_maps' is undefined.
This feature will be removed in a future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
The jinja check may not work as expected. This will be fixed in a future update.
License
This role is under the MIT license. See the LICENSE file for copyright and details.
ansible-galaxy install sedunne.autofs