Right now I replace content is files with e.g.replace { 'dummy5':
Is it possible to rename files with Puppet or is there a better way to replace content files?
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,
}
replace { 'dummy5':Er... I didn't even know a "replace" resource type existed. Where does it come from?
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: