Editing INI-style files with puppetlabs-inifile
INI files are used throughout the system, Puppet uses the INI syntax for the puppet.
conf
file. The puppetlabs-inifile
module creates two types:Â ini_setting
and ini_ subsetting
.
Getting ready
Install the module from the forge as follows:
t@mylaptop ~ $ puppet module install puppetlabs-inifile Notice: Preparing to install into /home/thomas/.puppetlabs/etc/code/modules ... Notice: Downloading from https://forgeapi.puppet.com ... Notice: Installing -- do not interrupt ... /home/thomas/.puppetlabs/etc/code/modules └── puppetlabs-inifile (v2.2.0)
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 apply initest.pp Notice: Compiled catalog...