Forge Home


Control a complete inifile

Andrew Grimberg



7,157 latest version

4.3 quality score

Version information

  • 1.1.0 (latest)
  • 1.0.0
released May 23rd 2016
This version is compatible with:
  • Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >=4.0.0 <5.0.0
  • RedHat

Start using this module


tykeal/ini_config — version 1.1.0 May 23rd 2016


Table of Contents

  1. Description
  2. Setup - The basics of getting started with ini_config
  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


Ever wanted a way to manage an entire INI configuration file and didn't want to subclass puppetlabs/inifile to let you force purge? Well, now you're in luck! This rather simple utility module is just what you need.


puppet module tykeal-ini_config


ini_config consists of a single define. At the most basic you're going to pass in a hash of the ini file that you want built up. For instance, the following will get you an almost empty configuration file. The only thing in it will be a header comment of ; MANAGED BY PUPPET and a few empty lines

ini_config { '/etc/my_config.ini':

That's not all that interesting though, here's a much more interesting example:

ini_config { /etc/':
  config              => {
        'testsection'     => {
            'testvar1'      => 'testvar1',
      'testvar2'      => [ 'testvar2.1', 'testvar2.2' ],
        'testsection.sub' => {
      'testvar3'      => 'testvar3',

Which will produce the following ini file


    testvar1 = testvar1
    testvar2 = testvar2.1
    testvar2 = testvar2.2

[testsection "sub"]
    testvar3 = testvar3


  • ensure Ensure if the file is present or absent

    **Type**: Enum - `present`, `absent`
    **Default**: `present`
    • config_file Absolute path to the file to manage.

      NOTE: If not set then the resource title will be used for the file to manage. If this is set it takes precedence over the resource title.

      Type: String

      Default: Empty

    • config A hash detailing the ini configuration that needs to be managed.

      The hash schema is as follows:

      $config         => {
          <OPTIONTITLE> => {
              <OPTIONKEY> => <OPTIONVALUE>
      OPTIONKEY   ::= <STRING>
      OPTIONVALUE ::= <STRING> | [ <STRING>, <STRING>, ... ]

      The OPTIONTITLE may containg a single "subsection" which is separated by a .

      Type: Hash

      Default: {}

    • mode The file mode octal to set

      Type: String matching pattern ^[0-7]{4}$

      Default: 0440

    • owner The owner of the file

      Type: String

      Default: root

    • group The group of the file

      Type: String

      Default: root

    • quotesubsection Boolean to determine if the the subsection title should be place inside " or not. Some ini-like systems cannot handle this and others require it.

      Type: Boolean

      Default: true

    • indentoptions Boolean to determine if the options of a section should be tab indented or not. Some ini-like systems cannot handle starting white space on their configuration lines

      Type: Boolean

      Default: true

    • show_diff Boolean to determine if the diff should be reported on a puppet run that changes the file contents

      Type: Boolean

      Default: true


While this module is flagged as only operating on RedHat and CentOS systems it should work on any system as it is extremely basic


Do you want to contribute? Please fork on github and send a PR!