how to remove all /etc/*.txt files with puppet
You can use a glob pattern with tidy: https://puppet.com/docs/puppet/latest/types/tidy.html
So this would be your solution:
tidy { "delete-txt-files-in-etc":
path => "/etc",
recurse => true,
matches => [ '*.txt' ],
rmdirs => false,
}
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.