Forge Home

augeas_base

adds defines to your toolkit, which help to turn settings hashes into configuration files.

6,740 downloads

6,615 latest version

4.5 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

  • 0.1.1 (latest)
  • 0.1.0
released Mar 3rd 2017
This version is compatible with:

Start using this module

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

Add this module to your Puppetfile:

mod 'dillec-augeas_base', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add dillec-augeas_base
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install dillec-augeas_base --version 0.1.1

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

dillec/augeas_base — version 0.1.1 Mar 3rd 2017

augeas_base module

Travis Build State

Table of Contents

  1. Description
  2. Setup - The basics of getting started with augeas_base module
    • [What augeas_base module affects](#what-augeas_base module-affects)
    • Setup requirements
    • [Beginning with augeas_base module](#beginning-with-augeas_base module)
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

The augeas_base module adds defines to your toolkit, which help to turn settings hashes into configuration files.

Why I should use augeas_base?

This module enables you to use the non-template pattern to create puppet modules. The idea is that you completely write configs with puppet by using puppet hashes and the power of augeas lenses.

Commonly used, the pattern looks like this

  • define $settings_hash variable in ::yourmodule::params to setup some defaults
  • define $_settings_hash variable as a parameter to ::yourmodule
  • use $settings_hash = deep_merge($_settings_hash, $::yourmodule::params::settings_hash) to merge both
  • write settings by using
    augeas_base::settings_to_file { '<file>':
        settings => $settings_hash
    }

Setup

Setup Requirements

The module requires, that you have the following puppet environment

  • puppet 3 or 4
  • augeas feature enabled
  • librarian or r10k to resolve dependencies
  • to run tests
    • rspec-puppet
    • beaker/serverspec

Beginning with augeas_base module

After adding augeas_base to your module dependencies, the module should be automatically loaded on each puppet run.

Usage

Use of augeas_base::settings_to_file

The settings_to_file define, will resolve the specified 'settings' hash into the specified file.

augeas_base::settings_to_file { '<file>':
  settings => {
    '<setting>' => '<setting-value>',
    ['<setting>' => '<setting-value>',]
  },
}

Please see the define documentation for more specifics.

overwrite global defaults

If you want to override specific defaults of the defines, you can define the augeas_base class like the following:

class { '::augeas_base':
  default_lens => 'Sshd.lns',
}->
augeas_base::settings_to_file {...}

How can I write settings to the same file with multiple settings_to_file or dirsettings_to_file calls

Just define unique IDs to the defines, and specify the config_file argument.

augeas_base:settings_to_file {'settings-/etc/ssh/sshd_config':
    config_file => '/etc/ssh/sshd_config',
    ...
}
augeas_base:dirsettings_to_file {'dirsettings-/etc/ssh/sshd_config':
    config_file => '/etc/ssh/sshd_config',
    ...
}

Reference

The following defines are added:

  • augeas_base::settings_to_file

The following classes are added:

  • augeas_base

Limitations

None known.

Development

If you like to contribute, feel free to fork and create pull requests.

Tests

Run all tests

vagrant provision --provision-with=lint,spec,serverspec_local

run spec/lint tests

To run spec/lint tests use the following command

  • vagrant provision --provision-with=spec
  • vagrant provision --provision-with=lint
  • alternatively, ssh to the box and use the cmdline out of Vagrantfile

run acceptance tests locally

To run acceptance tests locally, run this:

LOCAL_TEST=true rake serverspec_local

common way to do that:

  • change puppet-augeas_base/contrib/manifests/site.pp to the contents of let(:manifest)
  • run vagrant provision --provision-with=puppet on your host
  • exec serverspec_local by one of the following ways:
    • vagrant provision --provision-with=serverspec_local
    • ssh into vagrant box and exec the cmdline out of the Vagrantfile