1

我正在寻找以下内容的干版:

理想情况下,它可能只是一个数组和一个循环。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")
    }

  }
}
4

1 回答 1

1

像这样的东西怎么样:

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'
}

我在 Vagrant 规定中快速测试了它,它似乎有效?

于 2013-08-07T23:17:53.017 回答