- Overview
- Module Description - What the autofs does and why it is useful
- Setup - The basics of getting started with autofs
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
Manages the state and configuration of the autofs linux utility.
AutoFS is a linux package that manages the automount daemons. It provides a unified way to manage removable media or network share when they are inserted or accessed. This module, autofs, make sure the AutoFS package is installed, the service is running, and most importantly, it is configured correctly with appropriate maps.
- The autofs package.
- The autofs service.
- Autofs master and secondary map files, and consequentially any mounted filesystems.
In order to get a basic instance of AutoFS running:
include autofs
You can specify additional packages for the main autofs
class to install, thereby adding extra functionality to the autofs utility. An example of this would be adding LDAP and hesiod support on Debian:
class { 'autofs':
extra_packages => ['autofs-ldap', 'autofs-hesiod'],
}
AutoFS allows a direct map between a local mount point (mount_point
), and a filesystem (location
).
autofs::direct_map { 'Backups Drive':
location => 'backups:/global_backups',
options => ['rw'],
mount_point => '/backups',
}
This will add a map definition to the /etc/auto.direct
map file by default. If you want to specify a different map file:
autofs::direct_map { '/private':
location => 'castle:/secrets',
options => ['ro'],
map_file => '/etc/auto.private',
}
Indirect maps use a key to associate a mount point with a directory. In contrast to the autofs::direct_map
resource, both a key
(which defaults to $name
) and mount_point
need to be specified.
autofs::indirect_map { 'kernel':
mount_point => '/mnt',
location => 'ftp.kernel.org:/pub/linux',
options => ['ro', 'soft', 'intr'],
}
autofs::indirect_map { 'boot':
mount_point => '/mnt',
location => ':/dev/hda1',
options => ['fstype=ext2'],
}
This will create two indirect maps in a default map file /etc/auto.mnt
and setup the needed map definitions in the master map file. If a different map file is wanted for either or both, similarly to the autofs::direct_map
you can specify map_file
.
In order to directly create a master map you can use the autofs::master_map
defined type:
autofs::master_map { 'include misc mounts':
order => '99',
mount_point => '+',
map_name => '/etc/auto.misc',
}
autofs::master_map { 'LDAP mounts last':
order => '100',
mount_point => '/home',
map_name => 'ou=home,ou=autofs,dc=ted',
map_type => 'ldap',
format => 'sun',
}
This will add the following entries into the master autofs map file:
...
+/etc/auto.misc
/home ldap,sun:ou=home,ou=autofs,dc=ted
...
If for some reason you find this modules defined types to restrictive and need to add specific entries in map files that are not supported you can directly use the autofs::map_file
defined type.
autofs::master_map { 'include misc mounts':
order => '99',
mount_point => '+',
map_name => '/etc/auto.misc',
}
autofs::map_file { 'Custom misc maps':
ensure => present,
path => '/etc/auto.misc',
content => ' ... '
}
This example adds the custom content to the /etc/auto.misc
map file and, similar to before, adds the appropriate master map entry.
This defined type is intended to account for unforseen use. Likely you do not need to use this.
Manages the autofs package, templates, and service.
Name of the distribution specific autofs package.
Array of packages to install.
By default only the autofs packages is manages by this module. If extra support is desired for autofs (like LDAP or Hesiod), then the needed packages (i.e. autofs-hesiod, autofs-ldap, ... ) can be specified here.
Absolute file path where the master autofs template is located.
Absolute file path where the autofs map files are located.
This directory is not managed by this module, but is assumed to exist and be accessable as autofs map file will be put there.
Name of the distribution specific autofs service.
Defines an AutoFS direct map.
String defining the location from where the file system is to be mounted.
State to ensure of map. Valid values are present
and absent
.
Defaults to present
.
Absolute path where the direct map will mount the location.
Defaults to $name
.
Array of mount options used in the map definition.
Absolute path to file containing the direct map definition.
Defines an AutoFS indirect map.
Address of the filesystem to mount.
Absolute local path to the head of where the indirect map(s) are located.
State the map should be. Valid values are present
and absent
.
Defaults to present
.
Simple name for the map.
The indirect map will mount the location
at /mount_point/key
.
Defaults to $name
.
Array of mount options used in the map definition.
Absolute path to file containing the map definition. If none is provided the map will be defined in a create file named after the basename of the mountpoint prefixed by auto. withing the autofs::map_files_dir
.
Defines an autofs map in the master map file.
Required parameter defining the base location for the autofs filesystem to be mounted.
Name of the map to use.
This is an absolute UNIX pathname for maps of types file
or program
, and the name of a database in the case for maps of type yp
, nisplus
, or hesiod
, or the dn of an LDAP entry for maps of type ldap
or ldaps
.
Defaults to $name
.
State the specified map is in. Valid values are present
and absent
.
Defaults to present
.
Relative order the map will appean in the master map file.
The ordering is numeric and any maps that share the same order number are ordered by name.
Valid values are a string or an integer.
Defaults to '10'.
The autofs map type.
Valid values are: file
, program
, yp
, nisplus
, hesiod
, ldap
, or `ldaps'.
Defaults to file
.
The format of the map data.
Valid values are: sun
, or hesiod
.
Defaults to sun
.
Array of mount and map options.
Options without leading dashes (-) are taken as options (-o) to mount. Options with leading dashes are considered options for the maps.
Creates and manages content for an autofs map file.
State of the map file. Valid values are present
and absent
.
Defaults to present
.
Absolute path to the location of the map file to manage.
Defaults to $name
.
Specifies the user who owns the destination file.
Valid options: a string containing a user name.
Default value: 'root'
.
Specifies the group owner of the destination file.
Valid options: a string containing a group name.
Default value: 'root'
.
Specifies the permissions mode of the map file.
Valid options: a string containing an octal notation mode.
Default value: '0644'
.
Relative order the content will appear in the map file.
The ordering is numeric and any maps that share the same order number are ordered by name.
Valid values are a string or an integer.
Defaults to '10'.
Content to add to the map file.
Content to add to the map file.
This module is still in development and currently only being tested on Debian based systems.
It is planned to support all operating systems AutoFS is found on.