Puppet Class: autofs

Defined in:
manifests/init.pp

Summary

Manages the autofs facility, optionally including configuring mount points and maps.

Overview

Autofs mount points and their corresponding maps can also be managed via separate autofs::mount, autofs::mapfile, and autofs::mapping resources.

To use this module, simply declare it in your manifest. The module now supports the ability to not only enable autofs, but to also disable or uninstall it completely.

Examples:

Declaring the autofs class

include autofs

Removing the package

class { 'autofs':
  package_ensure => 'absent',
}

Disable the autofs service

class { 'autofs':
  service_ensure => 'stopped',
  service_enable => false,
}

using hiera with automatic lookup

---
autofs::mounts:
  home:
    mount: '/home'
    mapfile: '/etc/auto.home'
    options: '--timeout=120'
    order: 01
autofs::mapfiles:
  '/etc/auto.home':
    'mappings':
      - key: '*'
        options: 'user,rw,soft,intr,rsize=32768,wsize=32768,tcp,nfsvers=3,noacl'
        fs: 'server.example.com:/path/to/home/shares'

Parameters:

  • mounts (Hash[String, Hash]) (defaults to: {})

    the options with which to manage the autofs master map

  • purge_map_dir (Boolean) (defaults to: false)

    Purge the $map_dir directory of unmanaged

  • ldap_auth_conf_path (Stdlib::Absolutepath) (defaults to: '/etc/autofs_ldap_auth.conf')

    The path to the ldap_auth.conf file

  • ldap_auth_config (Hash) (defaults to: { 'usetls' => 'no', 'tlsrequired' => 'no', 'authrequired' => 'no' })

    The hash to use for the configuration settings in the ldap_auth.conf file

  • service_conf_path (Stdlib::Absolutepath) (defaults to: '/etc/sysconfig/autofs')

    The path to the service configuration file

  • service_options (Optional[Array[String]]) (defaults to: undef)

    An array of options to add to the OPTIONS variable in the service configuration file

  • service_conf_options (Optional[Hash]) (defaults to: undef)

    A hash of environment variables to add to the service configuration file for LDAP configuration

  • mapfiles (Optional[Hash[String, Hash]]) (defaults to: undef)

    replace: whether to modify the map file if it already exists

  • maps (Optional[Hash[String, Hash]]) (defaults to: undef)

    Deprecated. Use the mapfiles parameter instead.

  • package_ensure (String) (defaults to: 'installed')

    Determines the state of the package. Can be set to: installed, absent, lastest, or a specific version string.

  • package_name (Variant[String, Array[String]]) (defaults to: 'autofs')

    Determine the name of the package to install. Should be covered by hieradata.

  • package_source (Optional[String]) (defaults to: undef)

    Determine the source of the package, required on certain platforms (AIX)

  • service_ensure (Enum['stopped', 'running']) (defaults to: 'running')

    Determines state of the service. Can be set to: running or stopped.

  • service_enable (Boolean) (defaults to: true)

    Determines if the service should start with the system boot. true will start the autofs service on boot. false will not start the autofs service on boot.

  • service_name (String) (defaults to: 'autofs')

    Determine the name of the service for cross platform compatibility

  • auto_master_map (String) (defaults to: '/etc/auto.master')

    Filename of the auto.master map for cross platform compatiblity

  • map_file_owner (String) (defaults to: 'root')

    owner of the automount map files for cross platform compatiblity

  • map_file_group (String) (defaults to: 'root')

    group of the automount map files for cross platform compatiblity

  • manage_service_config (Boolean) (defaults to: false)

    Determines if the service configuration file (in /etc/default or /etc/sysconfig) should be managed

  • manage_ldap_auth_conf (Boolean) (defaults to: false)

    Determines if the /etc/autofs_ldap_auth.conf file should be managed

  • service_use_misc_device (Enum['no', 'yes']) (defaults to: 'yes')

    Sets the USE_MISC_DEVICE value in the service configuration file

  • reload_command (Optional[String]) (defaults to: undef)

    In lieu of a service reload capability in Puppet, exec this command to reload automount without restarting it.

  • automountd_service_ensure (Optional[Enum['stopped', 'running']]) (defaults to: undef)

    Determines state of the service. Can be set to: running or stopped.

  • autounmountd_service_ensure (Optional[Enum['stopped', 'running']]) (defaults to: undef)

    Determines state of the service. Can be set to: running or stopped.

  • automountd_service_name (Optional[String]) (defaults to: undef)

    Determine the name of the automountd service for cross platform compatibility

  • autounmountd_service_name (Optional[String]) (defaults to: undef)

    Determine the name of the autounmountd service for cross platform compatibility

See Also:

Author:

  • Vox Pupuli <voxpupuli@groups.io>

  • David Hollinger III <david.hollinger@moduletux.com>



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'manifests/init.pp', line 76

class autofs (
  String $package_ensure = 'installed',
  Hash[String, Hash] $mounts = {},
  Variant[String, Array[String]] $package_name = 'autofs',
  Boolean $service_enable = true,
  String $service_name = 'autofs',
  String $auto_master_map = '/etc/auto.master',
  String $map_file_owner = 'root',
  String $map_file_group = 'root',
  Boolean $manage_service_config = false,
  Boolean $manage_ldap_auth_conf = false,
  Enum['no', 'yes'] $service_use_misc_device = 'yes',
  Boolean $purge_map_dir  = false,
  Enum['stopped', 'running'] $service_ensure = 'running',
  Stdlib::Absolutepath $ldap_auth_conf_path = '/etc/autofs_ldap_auth.conf',
  Hash $ldap_auth_config = { 'usetls' => 'no', 'tlsrequired' => 'no', 'authrequired' => 'no' },
  Stdlib::Absolutepath $service_conf_path = '/etc/sysconfig/autofs',
  Optional[Hash[String, Hash]] $mapfiles = undef,
  Optional[Hash[String, Hash]] $maps = undef,  # deprecated
  Optional[String] $package_source = undef,
  Optional[String] $reload_command = undef,
  Optional[Array[String]] $service_options = undef,
  Optional[Hash] $service_conf_options = undef,
  Optional[Enum['stopped', 'running']] $automountd_service_ensure = undef,
  Optional[Enum['stopped', 'running']] $autounmountd_service_ensure = undef,
  Optional[String] $automountd_service_name = undef,
  Optional[String] $autounmountd_service_name = undef,
) {
  contain 'autofs::package'
  unless $package_ensure == 'absent' {
    contain 'autofs::service'
  }

  $mounts.each |String $mount, Hash $attributes| {
    autofs::mount { $mount: * => $attributes }
  }

  if $mapfiles =~ NotUndef {
    $mapfiles.each |String $file, Hash $attributes| {
      autofs::mapfile { $file: * => $attributes }
    }
  }

  if $maps =~ NotUndef {
    deprecation('autofs::maps', 'Class parameter $autofs::maps is deprecated and will be removed in a future version.  Define maps via the $mapfiles parameter instead')
    $maps.each |String $map, Hash $attributes| {
      autofs::map { $map: * => $attributes }
    }
  }
}