Forge Home

ini_config

Control a complete inifile

9,421 downloads

8,409 latest version

4.3 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.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

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
  • ,

Start using this module

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

Add this module to your Puppetfile:

mod 'tykeal-ini_config', '1.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add tykeal-ini_config
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install tykeal-ini_config --version 1.1.0

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

tykeal/ini_config — version 1.1.0 May 23rd 2016

ini_config

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

Description

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.

Setup

puppet module tykeal-ini_config

Usage

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/my_config.in':
  config              => {
        'testsection'     => {
            'testvar1'      => 'testvar1',
      'testvar2'      => [ 'testvar2.1', 'testvar2.2' ],
        },
        'testsection.sub' => {
      'testvar3'      => 'testvar3',
        },
    },
}

Which will produce the following ini file

; MANAGED BY PUPPET

[testsection]
    testvar1 = testvar1
    testvar2 = testvar2.1
    testvar2 = testvar2.2

[testsection "sub"]
    testvar3 = testvar3

Reference

  • 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>
          }
      }
      
      OPTIONTITLE ::= <STRING> | <STRING>"."<STRING>
      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

Limitations

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

Development

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