Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

How to map an array within a resource

$
0
0
I've got stuck trying to use Puppet 3.8 to tackle what seems like it should be a simple problem. My nodes have a number of independent installations of a single system. I have defined a top-level type which creates instances of many resources. My nodes then declare a number of instances, and all the resources are instantiated, just as I'd like. Now, I'd like to augment each installation with its own set of externally node-specified directories. So when my node declares...
installation { "user1":
    subdirs => ["subdir1", "subdir2"]
 }
I'd like to end up creating (say)
          /home/user1/subdir1
          /home/user1/subdir2
How do I do that? In particular, how (within the class) do I transform the list of subdirectory names
["subdir1", "subdir2"] 
into names that are unique to the instance of the class, such as
 ["installation1/$subdir1", "installation1/$subdir2" ]

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>