Skip to content

trefzer/puppet-autofs

 
 

Repository files navigation

Autofs Puppet Module

Travis branch Puppet Forge Puppet Forge Puppet Forge Puppet Forge

Table of Contents

  1. Description - - What the module does and why it is useful
  2. Setup - The basics of getting started with Autofs
  1. Usage - Configuration options and additional functionality
  2. Reference - An under-the-hood peek at what the module is doing and how
  3. Limitations - OS compatibility, etc
  4. Development - Guide for contributing to the module
  5. Support - When you need help with this module

Description

The Autofs module is a Puppet module for managing the configuration of automount network file system. This is a global module designed to be used by any organization. This module assumes the use of Hiera to set variables and serve up configuration files.

Setup

The Module manages the following:

  • Autofs package
  • Autofs service
  • Autofs Configuration File (/etc/auto.master)
  • Autofs Map Files (i.e. /etc/auto.home)

Requirements

Usage

The module includes a single class:

include autofs

By default this installs and starts the autofs service with the module's default master file.

You can also manage the state of the autofs package or service.

By default the module will install the autofs package and start/enable the autofs service. You can configure this by using the parameters defined in the main init class.

For example, to ensure the package is absent:

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

To ensure that a service is disabled and not running:

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

Map Files

To setup the Autofs Map Files, there is a defined type that can be used:

autofs::mount { 'home':
  mount       => '/home',
  mapfile     => '/etc/auto.home',
  mapcontents => ['* -user,rw,soft,intr,rsize=32768,wsize=32768,tcp,nfsvers=3,noacl server.example.com:/path/to/home/shares'],
  options     => '--timeout=120',
  order       => 01
}

This will generate content in both the auto.master file and a new auto.home map file:

auto.master
/home /etc/auto.home --timeout=120
auto.home
* -user,rw,soft,intr,rsize=32768,wsize=32768,tcp,nfsvers=3,noacl server.example.com:/path/to/home/shares

The defined type requires all parameters, except direct and execute, to build the autofs config. The direct and execute parameters allow for the creation of indirect mounts, see the Parameters section for more information on the defaults for direct and execute.

In hiera, there's a autofs::mounts class you can configure, for example:

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

The autofs module also supports the use of the built in autofs /- argument used with Direct Maps.

Examples:

Define:

autofs::mount { 'foo':
  mount       => '/-',
  mapfile     => '/etc/auto.foo',
  mapcontents => ['/foo -o options /bar'],
  options     => '--timeout=120',
  order       => 01
}

Hiera:

autofs::mounts:
  foo:
    mount: '/-'
    mapfile: '/etc/auto.foo'
    mapcontents:
      - '/foo -o options /bar'
    options: '--timeout=120'
    order: 01
Autofs +dir: options

The autofs module now supports the use of the +dir: option in the auto.master. This option is 100% functional, but does require some work to simplify it.

Usage

Define:

autofs::mount { 'home':
  mount       => '/home',
  mapfile     => '/etc/auto.home',
  mapcontents => ['* -user,rw,soft,intr,rsize=32768,wsize=32768,tcp,nfsvers=3,noacl server.example.com:/path/to/home/shares'],
  options     => '--timeout=120',
  order       => 01,
  use_dir     => true
}

Hiera:

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

Reference

Classes

Public Classes

  • autofs: Main class. Contains or calls all other classes or defines.

Private Classes

  • autofs::package: Handles autofs packages.
  • autofs::service: Handles the service.

Parameters

mounts

Optional.

Data type: Hash

A hash of options that will build the configuration. This hash is passed to the Defined type. Each hash key is the equivalent to a parameter in the autofs::mount defined type.

Default: undef

package_ensure

Data type: String

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

Default: 'installed'

service_ensure

Data type: Enum['running', 'stopped']

Determines state of the service.

Default: 'running'

service_enable

Data type: Boolean

Determines if the service should start with the system boot.

Default: true

Defines

Public Defines

  • autofs::mount: Builds the autofs configuration.

Parameters

mount_name

Data type: String

This is a logical, descriptive name for what what autofs will be mounting. This is represented by the home: and tmp: entries above.

mount

Data type: Stblib::Absolutepath

This Mapping describes where autofs will be mounting to. This map entry is referenced by concat as part of the generation of the /etc/auto.master file.

mapfile

Data type: Stdlib::Absolutepath

This Mapping describes the name and path of the autofs map file. This mapping is used in the auto.master generation, as well as generating the map file from the auto.map.erb template. This parameter is no longer required.

mapcontents

Data type: Array

This Mapping describes the folders that will be mounted, the mount options, and the path to the remote or local share to be mounted. Used in mapfile generation.

Default: []

options

Optional.

Data type: String

This Mapping describes the auto.master options to use (if any) when mounting the automounts.

Default: ''

order

Data type: Integer

This Mapping describes where in the auto.master file the entry will be placed. Order CANNOT be duplicated.

Default: undef

master

Data type: Stdlib::Absolutepath

This Parameter sets the path to the auto.master file.

Default: '/etc/auto.master'

map_dir

Data type: Stdlib::Absolutepath

This Parameter sets the path to the Autofs configuration directory for map files. Applies only to autofs 5.0.5 or later.

Default: '/etc/auto.master.d'

use_dir

Data type: Boolean

This Parameter tells the module if it is going to use $map_dir.

Default: false

direct

Data type: Boolean

Enable or disable indirect maps.

Default: true

execute

Data type: Boolean

Set mapfile to be executable.

Default: false

replace

Data type: Boolean

Whether or not to replace the mapfile if it already exists.

Default: true

Limitations

Removals

Directly calling the autofs::package and autofs::service classes is disabled in 3.0.0. These are now private classes.

Puppet platforms

Compatible with Puppet 4 only. Puppet 4.6.0 will provide best results.

Operating Systems

  • Supported
    • Ubuntu
      • 14.04
      • 16.04
    • CentOS/RHEL/Scientific/Oracle Linux
      • 6.x
      • 7.x
    • SLES
      • 11 Service Pack 4
      • 12 Service Pack 1
    • OpenSUSE 13.1
    • Debian
      • 7 "Wheezy"
      • 8 "Jessie"
  • Self Support - should work, support not provided by developer
    • Solaris 10, 11
    • Fedora 24, 25
    • SLES 10
    • CentOS/RHEL/Scientific/Oracle Linux 5.x
  • Unsupported
    • Windows (Autofs not available)
    • Mac OS X (Autofs Not Available)

Development

Please see the CONTRIBUTING.md file for instructions regarding development environments and testing.

Authors

Packages

No packages published

Languages

  • Ruby 67.7%
  • Puppet 27.2%
  • Shell 2.6%
  • HTML 2.5%