so i have a basic modification module which applies to all servers managed through hiera. One submodule is called "files" and puts the scripts to /usr/local/bin/ of each server. So it iterates through the files directory and copies corresponding files. This works fine if i add the module.
Now i want to make this module to be manageable over hiera via $enabled = true|false. The problem is, when setting the ensure => absent it deletes the bin dir and prints some errors messages that it cannot delete the files, apparently because the bin dir is already deleted. So what i want is to just delete the files and leave the bin dir itself.
Any ideas?
I stumbled upon this old bug which seems to describe the same issue which looks like have been patched.
UPDATE: The point is to not reference every file in the manifest. Thats why i want to use recurse.
files/ files/devvm files/devvm/script1.sh files/devvm/live.sh files/devvm-tpl.dev files/devvm-tpl.dev/testscript2.pl files/common files/common/change_hostname.sh files/srvDC221 files/srvDC221/wurst
class basemodifications::files ( $enabled = "true", ) { file { 'usrlocalbin': ensure => $enabled ? { "true" => present, "false" => absent, }, recurse => true, ignore => "*~", purge => true, owner => root, group => root, path => "/usr/local/bin/", #force => true, #will delete the bin directory sourceselect => all, source => ["puppet:///modules/tebasemod/common", "puppet:///modules/tebasemod/${::tecluster}", "puppet:///modules/tebasemod/${::fqdn}",] } }
err: /File[/usr/local/bin/wurst]/ensure: change from absent to file failed: Could not set 'file on ensure: No such file or directory - /usr/local/bin/wurst.puppettmp_6753