Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove all /etc/*.txt files with puppet

Tags:

puppet

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.

like image 208
David Portabella Avatar asked Sep 18 '13 14:09

David Portabella


People also ask

What is .pp file in puppet?

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.


1 Answers

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.

like image 93
Barfred Avatar answered Oct 08 '22 22:10

Barfred