Hello, Like many others, I once again had to deal with creation of deep directory trees with puppet. I did the usual:
file { [ "/a", "/a/b/", "/a/b/c"...]: ensure => directory } And again got sick of it. I still didn't find a good answer for it on the web so here is what I came up with in a moment of despair: define core::mkdirp($owner = undef, $group = undef) { exec { "mkdir -p ${name}": creates => $name, } file { $name: ensure => 'directory', require => Exec["mkdir -p ${name}"], owner => $owner, group => $group, } } Usage: core::mkdirp { "/a/b/c/d": owner => $user, group => $group, } file { "/a/b/c/d/file.txt": require => Core::Mkdirp["/a/b/c/d"], ... } So far it works beautifully for me but I want to hear what the community thinks of it and whether there is a nicer solution I'm missing. Thanks. --Amos -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ozFNn2oUGCQJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.