Giter Club home page Giter Club logo

puppet-augeas_base's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.