No description
Find a file
Chris Price e824ab2aba Merge pull request #29 from kbrezina/subsetting
Added 'ini_subsetting' custom resource type
2013-03-25 11:00:41 -07:00
lib/puppet Merge pull request #29 from kbrezina/subsetting 2013-03-25 11:00:41 -07:00
spec Merge pull request #29 from kbrezina/subsetting 2013-03-25 11:00:41 -07:00
tests Added 'ini_subsetting' custom resource type 2013-03-25 11:34:37 +01:00
CHANGELOG Update Modulefile/CHANGELOG ; final commit for v0.9.0 release 2012-11-02 12:45:11 -07:00
LICENSE Added license file w/Apache 2.0 license 2012-11-06 13:53:15 -08:00
Modulefile Update Modulefile/CHANGELOG ; final commit for v0.9.0 release 2012-11-02 12:45:11 -07:00
README.markdown Added 'ini_subsetting' custom resource type 2013-03-25 11:34:37 +01:00

INI-file module

This module provides resource types for use in managing INI-style configuration files. The main resource type is ini_setting, which is used to manage an individual setting in an INI file. Here's an example usage:

ini_setting { "sample setting":
  path    => '/tmp/foo.ini',
  section => 'foo',
  setting => 'foosetting',
  value   => 'FOO!',
  ensure  => present,
}

A supplementary resource type is ini_subsetting, which is used to manage settings that consist of several arguments such as

JAVA_ARGS="-Xmx192m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/pe-puppetdb/puppetdb-oom.hprof "

ini_subsetting {'sample subsetting':
  ensure  => present,
  section => '',
  key_val_separator => '=',
  path => '/etc/default/pe-puppetdb',
  setting => 'JAVA_ARGS',
  subsetting => '-Xmx',
  value   => '512m',
}

A few noteworthy features:

  • The module tries hard not to manipulate your file any more than it needs to. In most cases, it should leave the original whitespace, comments, ordering, etc. perfectly intact.
  • Supports comments starting with either '#' or ';'.
  • Will add missing sections if they don't exist.
  • Supports a "global" section (settings that go at the beginning of the file, before any named sections) by specifying a section name of "".