On Monday, March 17, 2014 5:31:47 PM UTC+1, Jasmine Lognnes wrote:
> Right now I replace content is files with e.g.
>
> replace { 'dummy5':
>
Er... I didn't even know a "replace" resource type existed. Where does it
come from?
> Is it possible to rename files with Puppet or is there a better way to
> replace content files?
>
There's no easy way to rename a file AFAIK.
You can use something like this but it's far from ideal (and OS dependent
of course):
exec { '/bin/mv /etc/xdg/user-dirs.conf /etc/xdg/user-dirs.conf_false':
creates => '/etc/xdg/user-dirs.conf_false',
}
->
file { '/etc/xdg/user-dirs.conf':
ensure => absent,
}
Regarding modifying content, you can have a look at the augeas resource
type. You need to have Augeas installed on the machine, but if the files to
be modified have some standard format then you might be lucky because you
can do your edits without much effort.
Some useful links:
http://docs.puppetlabs.com/references/3.stable/type.html#augeas
http://docs.puppetlabs.com/guides/augeas.html
http://doauto.wordpress.com/2013/06/22/how-to-change-a-file-using-puppet/
Marco
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/cc09fee7-03d9-4abf-a1ea-817925eee7b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.