file_line manifest

48 views
Skip to first unread message

puppetstan

unread,
Apr 14, 2014, 7:31:06 AM4/14/14
to puppet...@googlegroups.com
Hello

I would like
to check in my manifest the presence of a line in a configuration file under [main] and above [config]

With my manifest configuration, it adds my line at the end of file

Can you have an idea?

thank you in advance



my manifest :

file_line { "yum protect":
    line  => "protect=1",
    path  => "/etc/yum.conf",
    match => "protect=.*$",
    ensure => present
  }


my file :

[main]
enabled = 1
gpgcheck = 1
priority = 10
protect = 1

[config]
enabled = 1



Paul Tötterman

unread,
Apr 14, 2014, 9:30:09 AM4/14/14
to puppet...@googlegroups.com
Hi,
 
Can you have an idea?

Your regular expression doesn't match the existing setting. Since you are dealing with an ini-file, try using puppetlabs-inifile <https://forge.puppetlabs.com/puppetlabs/inifile> instead of file_line.

Cheers,
Paul

puppetstan

unread,
Apr 15, 2014, 10:45:44 AM4/15/14
to puppet...@googlegroups.com
Thanks a lot this manifest is good

Thanks!

ini_setting { "rhnplugin":
  ensure  => present,
  path    => '/etc/yum/pluginconf.d/rhnplugin.conf',
  section => 'main',
  setting => 'protect',
  value   => '1',
Reply all
Reply to author
Forward
0 new messages