this puppet manifest will remove the file /etc/file.txt
if it exists:
file { "/etc/file.txt":
ensure => absent,
}
how to tell puppet to remove all files /etc/*.txt
?
according to the reference, it seems that puppet file
does not allow wildcards.
https://puppet.com/docs/puppet/latest/types/file.html
ps: I am aware that I could execute a script from puppet, but I would prefer another more elegant way.
In Puppet, all the programs which are written using Ruby programming language and saved with an extension of . pp are called manifests. In general terms, all Puppet programs which are built with an intension of creating or managing any target host machine is called a manifest.
There's a built-in type for this called 'tidy', which allows you to specify a file glob pattern of files to remove.
Check it out at https://puppet.com/docs/puppet/latest/types/tidy.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With