Forge Home

fsutil

Some helpful filesystem functions to minimise code repetition.

7,809 downloads

1,928 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.0.4 (latest)
  • 1.0.3
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Aug 31st 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'qtechnologies-fsutil', '1.0.4'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add qtechnologies-fsutil
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install qtechnologies-fsutil --version 1.0.4

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

qtechnologies/fsutil — version 1.0.4 Aug 31st 2020

puppet-fsutil

Some helpful filesystem functions to minimise code repetition.

Table of Contents

  1. Description
  2. Instructions
  3. Reference
  4. Development
  5. Issues

Description

This fsutil module provides a higher level interface to common filesystem actions. It aims to reduce the code in your profiles. Most of the action can be driven through Hiera. Some assumptions are made:

  • only performs the mount action (and inserts entry into fstab)
  • manages the mount point directory

Instructions

Call the class from your code, e.g.

class { 'fsutil': }

or

include 'fsutil'

Use Hiera to drive the configuration. E.g.:

fsutil::nfs_mounts:
  /code: mac:/Users/matt/code
  /downloads: 
    device: mac:/Users/matt/Downloads
    options: ro,hard,intr

Reference

Data Structures

nfs_mounts

To mount a number of NFS mounts, define a Hash in Hiera with all the mount points as the keys. The Hash values can either be a String of the remote share to mount or another Hash with the following additional options:

  • device - remote share to mount
  • options (default = 'defaults') - the mount options to use,
  • mode (default = 0755) - the mode of the mount point
  • umask (default = 0022) - the umask to use when any parent directories get created Any parent directories needed for the mount point (and the mount point itself) will be created and managed by Puppet

Defined Resources

fsutil::mount_nfs

Mounts a remote NFS share on a local mount point. Options:

  • device - remote share to mount
  • options (default = 'defaults') - the mount options to use,
  • mode (default = 0755) - the mode of the mount point
  • umask (default = 0022) - the umask to use when any parent directories get created Any parent directories needed for the mount point (and the mount point itself) will be created and managed by Puppet Example:
fsutil::mount_nfs { '/downloads':
  device  => 'mac:/Users/matt/Downloads',
  options => 'ro,hard,intr',
}

fsutil::mkmount

Creates a full path of directories and sets the mode for a mount point. Options:

  • mode (default = 0755) - the mode of the mount point
  • umask (default = 0022) - the umask to use when any parent directories get created Example:
fsutil::mkmount {  '/temp':
  mode    => '0777',
  umask   => '0222',
}

fsutil::mkdir_p

Creates a full path of directories. Options:

  • umask (default = 0022) - the umask to use when any parent directories get created Example:
fsutil::mkdir_p { '/secrets': 
  umask   => '0200',
}

fsutil::mktree

Creates a full tree of directories. It expands a Hash or Array (or combination) and uses the fsutil::mkmount resource to create the directory. Options:

  • umask (default = 0022) - the umask to use when any parent directories get created
  • mode (default = 0755) - the mode of the directory Example:
fsutil::mktree { '/secrets': 
  umask   => '0200',
  umask   => '0755',
  tree => { '/repo' => ['baseline', 'packages', {'os' => [{'Centos' => [6, 7]}]}]}],
}

This will create the following directories:

/repo
/repo/baseline
/repo/packages
/repo/os
/repo/os/Centos
/repo/os/Centos/6
/repo/os/Centos/7

Alternatively, you can specify hiera data and include the class:

fsutil::tree:
  repo:
    - baseline
    - packages
    - os:
      - Centos:
        - 6
        - 7

Development

If you would like to contribute to or comment on this module, please do so at it's Github repository. Thanks.

Issues

This module is using hiera data that is embedded in the module rather than using a params class. This may not play nicely with other modules using the same technique unless you are using hiera 3.0.6 and above (PE 2015.3.2+).