Editing INI style files with puppetlabs-inifile
INI files are used throughout many systems, Puppet uses INI syntax for the puppet.conf
file. The puppetlabs-inifile
module creates two types, ini_setting
and ini_subsetting
, which can be used to edit INI style files.
Getting ready
Install the module from the forge as follows:
t@mylaptop ~ $ puppet module install puppetlabs-inifile Notice: Preparing to install into /home/tuphill/.puppet/modules ... Notice: Downloading from https://forgeapi.puppetlabs.com ... Notice: Installing -- do not interrupt ... /home/tuphill/.puppet/modules └── puppetlabs-inifile (v1.1.3)
How to do it...
In this example, we will create a /tmp/server.conf
file and ensure that the server_true
setting is set in that file:
Create an
initest.pp
manifest with the following contents:ini_setting {'server_true': path => '/tmp/server.conf', section => 'main', setting => 'server', value => 'true', }
Apply the manifest:
t@mylaptop ~/.puppet/manifests...