ruby - Iterating over files in Puppet (3.1) -
i looking dry version of following:
ideally array , loop. way go in puppet?
class hive_cdh4::configs inherits hive_cdh4 { define hive_configs () { file { "/etc/hive/conf.rr/hive-site.xml": owner => root, group => root, mode => 664, ensure => present, content => template("hive_cdh4/hive-site.xml.erb") } file { "/etc/hive/conf.rr/hive-exec-log4j.properties": owner => root, group => root, mode => 664, ensure => present, content => template("hive_cdh4/hive-exec-log4j.properties.erb") } file { "/etc/hive/conf.rr/hive-log4j.properties": owner => root, group => root, mode => 664, ensure => present, content => template("hive_cdh4/hive-log4j.properties.erb") } } }
how this:
define hive_config ($file_name = $title, $format = 'properties') { file { "/etc/hive/conf.rr/$file_name.$format": owner => root, group => root, mode => '0664', ensure => present, content => template("hive_cdh4/$file_name.$format.erb") } } hive_config {'hive-site':} hive_config {'hive-exec-log4j':} hive_config {'hive-log4j': format => 'xml' }
i tested in vagrant provision, , seems work?
Comments
Post a Comment