Nice... I solved my probleman using the:

define replace($file, $pattern, $replacement) {
  exec { "/usr/bin/perl -pi -e 's/$pattern/$replacement/' '$file'":
      onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if
/$pattern/ && ! /$replacement/ ; END { exit \$ret; }' '$file'",
   }
}

Then i my class used:

replace { "/etc/bashrc":
   file => "/etc/bashrc",
   pattern => "PS1",
   replacement => "PS1 DOMAINA.COM"
}
Worked perfectly... Know i will see the other options proposed here. Thank
you evry much guys

-- 
Marley Bacelar
Project Fedora Ambassador
VCP, VSP. VTSP., ITILF, IBM 000-076, IBM 000-330, IBM 000-331
marleybace...@gmail.com

2010/5/21 R.I.Pienaar <r...@devco.net>

> > The vast majority of our text replacement work we do is for files that
> > have simple key/value pairs with an assignment operator.
> >
> >
> > foo=bar
> > foo: bar
> >
> >
> > etc.
> >
> >
> > We occasionally stray outside this with a regexp replacer, but I
> > totally agree with Daniel here, it's not the most robust thing in the
> > world.
> >
> >
> > Generally we do this because we want to allow people to customize
> > extra parts of their config files, and we've switched daemons entirely
> > for some services, simply based upon their ability to cope with a
> > parts.d directory or to have "include" directives of some kind.
> >
> >
> > That allows you to ship an absolute config with a default include that
> > people are free to modify.
> >
>
>
> fwiw, the newest version of my concat module supports symlinking into a
> concat file, so if you have a config file that you would like users to drop
> settings it and you want them to only do so in a very specific place in a
> file you can now achieve that by building your config file and including a
> user editable file right where you want it.
>
> Very nice feature to give users some rights without loosing control of the
> file or its structure.
>
> It wouldn't be too hard to extend it to make arbitrary user supplied .d
> directories for daemons that dont support those :)
>
> http://github.com/ripienaar/puppet-concat
>
>
> --
> R.I.Pienaar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to