On Wednesday, May 28, 2014 10:24:25 AM UTC-5, Jeremy wrote: > > On 28.05.2014 11:03, Supriya Uppalapati wrote: > > Hi, > > > > I have created directories in puppet/manifests/init.pp > > > > more init.pp > > class createdirectory { > > file { [ "/u01/app/","/u01/oracle", "/u01/oracle/product", ]: > > ensure => "directory", > > owner => "oracle", > > group => "oinstall", > > recurse => true, > > mode => 755, > > } > > } > > > > But, now I want to specify the "/U01/APP/","/U01/ORACLE", > > "/U01/ORACLE/PRODUCT" this contents using hiera. Is there any way to > > do this. > > > > LET ME KNOW. > > > > Setup something like... > > some_oracle_variable: > - /u01/app > - /u01/oracle > - /u01/oracle/product > > in your hiera data then update your init.pp to include something > like... > > class createdirectory { > $some_directories = hiera_array('some_oracle_variable', []) >
Note well: you do not need hiera_array() just because the data are in the form of an array. The plain hiera() function will return an array if that is in fact the type of the data. The hiera_array() function has significantly different semantics, collecting data from all levels of the hierarchy instead of from only the highest-priority level where the data appear. > file { $some_directories: > ensure => "directory", > owner => "oracle", > group => "oinstall", > recurse => true, > mode => 755, > } > } > > But that's just spit balling it off the cuff and without actually > testing. > It looks ok to me, except as noted above. It could also be done by parameterizing the class and relying on automated data binding instead of an explicit lookup. Many people seem to prefer that approach, but I don't find the advantages -- and there are one or two -- to be particularly compelling. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fe13ca44-db1c-4e75-b3df-d6daa445dbe4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.