- Description
- 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)
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
The augeas_base module adds defines to your toolkit, which help to turn settings hashes into configuration files.
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
}
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
After adding augeas_base to your module dependencies, the module should be automatically loaded on each puppet run.
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.
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',
...
}
The following defines are added:
augeas_base::settings_to_file
The following classes are added:
augeas_base
None known.
If you like to contribute, feel free to fork and create pull requests.
Run all tests
vagrant provision --provision-with=lint,spec,serverspec_local
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
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