{"id":15022732,"url":"https://github.com/puppetlabs/puppetlabs-inifile","last_synced_at":"2026-05-19T08:14:39.670Z","repository":{"id":37550457,"uuid":"4664563","full_name":"puppetlabs/puppetlabs-inifile","owner":"puppetlabs","description":"Resource types for managing settings in INI files","archived":false,"fork":false,"pushed_at":"2025-04-23T12:19:28.000Z","size":922,"stargazers_count":69,"open_issues_count":12,"forks_count":177,"subscribers_count":173,"default_branch":"main","last_synced_at":"2025-05-03T01:55:42.183Z","etag":null,"topics":["hacktoberfest","module","supported"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puppetlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-06-14T14:52:16.000Z","updated_at":"2025-04-23T12:19:32.000Z","dependencies_parsed_at":"2022-08-08T20:31:10.840Z","dependency_job_id":"c4ff3068-4aa0-42f3-a63a-3eaa8f508094","html_url":"https://github.com/puppetlabs/puppetlabs-inifile","commit_stats":{"total_commits":531,"total_committers":111,"mean_commits":4.783783783783784,"dds":0.8851224105461394,"last_synced_commit":"1915a39469b429aa1c2210d2de27b14791153e50"},"previous_names":["cprice-puppet/puppetlabs-inifile"],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-inifile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-inifile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-inifile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-inifile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puppetlabs","download_url":"https://codeload.github.com/puppetlabs/puppetlabs-inifile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043220,"owners_count":22004912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","module","supported"],"created_at":"2024-09-24T19:58:19.599Z","updated_at":"2026-02-09T12:17:18.862Z","avatar_url":"https://github.com/puppetlabs.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inifile\n\n#### Table of Contents\n\n1. [Overview](#overview)\n1. [Module Description - What the module does and why it is useful](#module-description)\n1. [Setup - The basics of getting started with inifile module](#setup)\n1. [Usage - Configuration options and additional functionality](#usage)\n1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)\n1. [Limitations - OS compatibility, etc.](#limitations)\n1. [License](#license)\n1. [Development - Guide for contributing to the module](#development)\n\n\u003ca id=\"overview\"\u003e\u003c/a\u003e\n## Overview\n\nThe inifile module lets Puppet manage settings stored in INI-style configuration files.\n\n\u003ca id=\"module-description\"\u003e\u003c/a\u003e\n## Module Description\n\nMany applications use INI-style configuration files to store their settings. This module supplies two custom resource types to let you manage those settings through Puppet.\n\n\u003ca id=\"setup\"\u003e\u003c/a\u003e\n## Setup\n\n### Beginning with inifile\n\nTo manage a single setting in an INI file, add the `ini_setting` type to a class:\n\n~~~puppet\nini_setting { \"sample setting\":\n  ensure  =\u003e present,\n  path    =\u003e '/tmp/foo.ini',\n  section =\u003e 'bar',\n  setting =\u003e 'baz',\n  value   =\u003e 'quux',\n}\n~~~\n\n\u003ca id=\"usage\"\u003e\u003c/a\u003e\n## Usage\n\n\nThe inifile module is used to:\n\n * Support comments starting with either '#' or ';'.\n * Support either whitespace or no whitespace around '='.\n * Add any missing sections to the INI file.\n\nIt does not manipulate your file any more than it needs to. In most cases, it doesn't affect the original whitespace, comments, or ordering. See the common usages below for examples.\n\n### Manage multiple values in a setting\n\nUse the `ini_subsetting` type:\n\n~~~puppet\nini_subsetting {'sample subsetting':\n  ensure            =\u003e present,\n  section           =\u003e '',\n  key_val_separator =\u003e '=',\n  path              =\u003e '/etc/default/pe-puppetdb',\n  setting           =\u003e 'JAVA_ARGS',\n  subsetting        =\u003e '-Xmx',\n  value             =\u003e '512m',\n}\n~~~\n\nResults in managing this `-Xmx` subsetting:\n\n~~~puppet\nJAVA_ARGS=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/pe-puppetdb/puppetdb-oom.hprof\"\n~~~\n\n\n### Use a non-standard section header\n\n~~~puppet\nini_setting { 'default minage':\n  ensure         =\u003e present,\n  path           =\u003e '/etc/security/users',\n  section        =\u003e 'default',\n  setting        =\u003e 'minage',\n  value          =\u003e '1',\n  section_prefix =\u003e '',\n  section_suffix =\u003e ':',\n}\n~~~\n\nResults in:\n\n~~~puppet\ndefault:\n   minage = 1\n~~~\n\n### Use a non-standard indent character\n\nTo use a non-standard indent character or string for added settings, set the `indent_char` and the `indent_width` parameters. The `indent_width` parameter controls how many `indent_char` appear in the indent.\n\n\n~~~puppet\nini_setting { 'procedure cache size':\n  ensure         =\u003e present,\n  path           =\u003e '/var/lib/ase/config/ASE-16_0/SYBASE.cfg',\n  section        =\u003e 'SQL Server Administration',\n  setting        =\u003e 'procedure cache size',\n  value          =\u003e '15000',\n  indent_char    =\u003e \"\\t\",\n  indent_width   =\u003e 2,\n}\n~~~\n\nResults in:\n\n~~~puppet\n[SQL Server Administration]\n\t\tprocedure cache size = 15000\n~~~\n\n### Implement child providers\n\nYou might want to create child providers that inherit the `ini_setting` provider for one of the following reasons:\n\n * To make a custom resource to manage an application that stores its settings in INI files, without recreating the code to manage the files themselves.\n * To [purge all unmanaged settings](https://docs.puppetlabs.com/references/latest/type.html#resources-attribute-purge) from a managed INI file.\n\nTo implement child providers, first specify a custom type. Have it implement a namevar called `name` and a property called `value`:\n\n~~~ruby\n#my_module/lib/puppet/type/glance_api_config.rb\nPuppet::Type.newtype(:glance_api_config) do\n  ensurable\n  newparam(:name, :namevar =\u003e true) do\n    desc 'Section/setting name to manage from glance-api.conf'\n    # namevar should be of the form section/setting\n    newvalues(/\\S+\\/\\S+/)\n  end\n  newproperty(:value) do\n    desc 'The value of the setting to define'\n    munge do |v|\n      v.to_s.strip\n    end\n  end\nend\n~~~\n\nYour type also needs a provider that uses the `ini_setting` provider as its parent:\n\n~~~ruby\n# my_module/lib/puppet/provider/glance_api_config/ini_setting.rb\nPuppet::Type.type(:glance_api_config).provide(\n  :ini_setting,\n  # set ini_setting as the parent provider\n  :parent =\u003e Puppet::Type.type(:ini_setting).provider(:ruby)\n) do\n  # implement section as the first part of the namevar\n  def section\n    resource[:name].split('/', 2).first\n  end\n  def setting\n    # implement setting as the second part of the namevar\n    resource[:name].split('/', 2).last\n  end\n  # hard code the file path (this allows purging)\n  def self.file_path\n    '/etc/glance/glance-api.conf'\n  end\nend\n~~~\n\nNow you can manage the settings in the `/etc/glance/glance-api.conf` file as individual resources:\n\n~~~puppet\nglance_api_config { 'HEADER/important_config':\n  value =\u003e 'secret_value',\n}\n~~~\n\nIf you've implemented `self.file_path`, you can have Puppet purge the file of the all lines that aren't implemented as Puppet resources:\n\n~~~puppet\nresources { 'glance_api_config':\n  purge =\u003e true,\n}\n~~~\n\n### Manage multiple ini_settings\n\nTo manage multiple `ini_settings`, use the [`inifile::create_ini_settings`](REFERENCE.md#inifilecreate_ini_settings) function.\n\n~~~puppet\n$defaults = { 'path' =\u003e '/tmp/foo.ini' }\n$example = { 'section1' =\u003e { 'setting1' =\u003e 'value1' } }\ninifile::create_ini_settings($example, $defaults)\n~~~\n\nResults in:\n\n~~~puppet\nini_setting { '[section1] setting1':\n  ensure  =\u003e present,\n  section =\u003e 'section1',\n  setting =\u003e 'setting1',\n  value   =\u003e 'value1',\n  path    =\u003e '/tmp/foo.ini',\n}\n~~~\n\nTo include special parameters, use the following code:\n\n~~~puppet\n$defaults = { 'path' =\u003e '/tmp/foo.ini' }\n$example = {\n  'section1' =\u003e {\n    'setting1'  =\u003e 'value1',\n    'settings2' =\u003e {\n      'ensure' =\u003e 'absent'\n    }\n  }\n}\ninifile::create_ini_settings($example, $defaults)\n~~~\n\nResults in:\n\n~~~puppet\nini_setting { '[section1] setting1':\n  ensure  =\u003e present,\n  section =\u003e 'section1',\n  setting =\u003e 'setting1',\n  value   =\u003e 'value1',\n  path    =\u003e '/tmp/foo.ini',\n}\nini_setting { '[section1] setting2':\n  ensure  =\u003e absent,\n  section =\u003e 'section1',\n  setting =\u003e 'setting2',\n  path    =\u003e '/tmp/foo.ini',\n}\n~~~\n\n#### Manage multiple ini_settings with Hiera\n\nFor the profile `example`:\n\n~~~puppet\nclass profile::example (\n  Hash $settings,\n) {\n  $defaults = { 'path' =\u003e '/tmp/foo.ini' }\n  inifile::create_ini_settings($settings, $defaults)\n}\n~~~\n\nProvide this in your Hiera data:\n\n~~~puppet\nprofile::example::settings:\n  section1:\n    setting1: value1\n    setting2: value2\n    setting3:\n      ensure: absent\n~~~\n\nResults in:\n\n~~~puppet\nini_setting { '[section1] setting1':\n  ensure  =\u003e present,\n  section =\u003e 'section1',\n  setting =\u003e 'setting1',\n  value   =\u003e 'value1',\n  path    =\u003e '/tmp/foo.ini',\n}\nini_setting { '[section1] setting2':\n  ensure  =\u003e present,\n  section =\u003e 'section1',\n  setting =\u003e 'setting2',\n  value   =\u003e 'value2',\n  path    =\u003e '/tmp/foo.ini',\n}\nini_setting { '[section1] setting3':\n  ensure  =\u003e absent,\n  section =\u003e 'section1',\n  setting =\u003e 'setting3',\n  path    =\u003e '/tmp/foo.ini',\n}\n~~~\n\n\u003ca id=\"reference\"\u003e\u003c/a\u003e \n## Reference\nSee [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-inifile/blob/main/REFERENCE.md)\n\n\u003ca id=\"limitations\"\u003e\u003c/a\u003e\n\n## Limitations\n\n### Supported operating systems\n\nFor an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-inifile/blob/main/metadata.json)\n\n### create_ini_settings\n\nWhen using inifile::create_ini_settings it’s worth noting that namespace tags will not be applied to the resource. If you need these namespace tags we advise using the standard ini_setting resource.\n\nFor more information about resource tags, please see [this article](https://puppet.com/docs/puppet/7/lang_tags.html#lang_tags-assigning-tags-to-resources).\n\n\u003ca id=\"license\"\u003e\u003c/a\u003e \n## License\n\nThis codebase is licensed under the Apache2.0 licensing, however due to the nature of the codebase the open source dependencies may also use a combination of [AGPL](https://opensource.org/license/agpl-v3/), [BSD-2](https://opensource.org/license/bsd-2-clause/), [BSD-3](https://opensource.org/license/bsd-3-clause/), [GPL2.0](https://opensource.org/license/gpl-2-0/), [LGPL](https://opensource.org/license/lgpl-3-0/), [MIT](https://opensource.org/license/mit/) and [MPL](https://opensource.org/license/mpl-2-0/) Licensing.\n\n\u003ca id=\"development\"\u003e\u003c/a\u003e \n## Development\n\nWe are experimenting with a new tool for running acceptance tests. It's name is [puppet_litmus](https://github.com/puppetlabs/puppet_litmus) this replaces beaker as the test runner. To run the acceptance tests follow the instructions [here](https://github.com/puppetlabs/puppet_litmus/wiki/Tutorial:-use-Litmus-to-execute-acceptance-tests-with-a-sample-module-(MoTD)#install-the-necessary-gems-for-the-module).\n\nPuppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.\n\nWe want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.\n\nFor more information, see our [module contribution guide.](https://puppet.com/docs/puppet/latest/contributing.html)\n\n### Contributors\n\nTo see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-inifile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-inifile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-inifile/lists"}