Defined Type: autofs::map

Defined in:
manifests/map.pp

Summary

Defined type to generate autofs map entry configuration files.

Overview

Examples:

Using the autofs::map defined type to setup automount for nfs data directory.

autofs::map { 'data':
  mapcontents => 'mydata -user,rw,soft,intr,rsize=32768,wsize=32768  nfs.example.org:/path/to/some/data',
  mapfile => '/etc/auto.data',
  order   => '01',
}

Parameters:

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    Whether to create the mapfile or not.

  • mapcontents (Variant[Array, String]) (defaults to: [])

    The mount point options and parameters, Example: ‘* -user,rw,soft nfs.example.org:/path/to’

  • mapfile (Stdlib::Absolutepath) (defaults to: $title)

    Name of the “auto.” configuration file that will be generated.

  • template (Enum['autofs/auto.map.erb', 'autofs/auto.map.exec.erb']) (defaults to: 'autofs/auto.map.erb')

    Template to use to generate the mapfile.

  • mapmode (String) (defaults to: '0644')

    UNIX permissions to be added to the file.

  • replace (Boolean) (defaults to: true)

    Whether or not to replace an existing mapfile of the same filename/path.

  • order (Integer) (defaults to: 1)

    Order in which entries will appear in the autofs map file.

See Also:

Author:

  • Vox Pupuli <voxpupuli@groups.io>

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



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'manifests/map.pp', line 27

define autofs::map (
  Enum['present', 'absent'] $ensure                                 = 'present',
  Stdlib::Absolutepath $mapfile                                     = $title,
  Enum['autofs/auto.map.erb', 'autofs/auto.map.exec.erb'] $template = 'autofs/auto.map.erb',
  String $mapmode                                                   = '0644',
  Boolean $replace                                                  = true,
  Integer $order                                                    = 1,
  Variant[Array, String] $mapcontents                               = [],
) {
  include 'autofs'

  unless $autofs::package_ensure == 'absent' {
    if $autofs::reload_command {
      Concat {
        before => Service[$autofs::service_name],
        notify => Exec['automount-reload'],
      }
    } else {
      Concat {
        notify => Service[$autofs::service_name],
      }
    }
  }

  ensure_resource(concat, $mapfile, {
      ensure  => $ensure,
      owner   => $autofs::map_file_owner,
      group   => $autofs::map_file_group,
      mode    => $mapmode,
      replace => $replace,
      require => Class['autofs::package'],
    }
  )

  unless $ensure == 'absent' {
    concat::fragment { "${mapfile}_${name}_entries":
      target  => $mapfile,
      content => template($template),
      order   => $order,
    }
  }
}