SunLynx
SunLynx

Reputation: 57

How to edit a file and pass values into it through Puppet

I want to pass limit values in /etc/security/limits.conf in all servers available in environment through puppet. Need to be automated this process whenever i create new instance, this limit values directly append to new boxes

Upvotes: 1

Views: 205

Answers (1)

mat1010
mat1010

Reputation: 847

There's an official puppet module for modifying limits.

You could also use file_line for this.

file_line { 'append_limits_conf':
  path => '/etc/security/limits.conf',
  match => 'variable_name',
  line => 'vriable_name = foobar',
}

The match will be used to determine if the variable is already declared within the file. If yes - it will change the value to whatever you define at line. If it's not in there it will just append the line.

More sophisticated file editing can be done with augeas - but might be overkill for you case right now.

Upvotes: 1

Related Questions