puppet 语法学习变量

变量类型

字符串

 $a_string = 'This is a string value'

数组

 $an_array = [ 'This', 'forms', 'an', 'array' ] 

哈希

 $a_hash = { 'subject' => 'Hashes',
'predicate' => 'are written',
'object' => 'like this',
'note' => 'not actual grammar!',
'also note' => [ 'nesting is', { 'allowed' => 'of course' } ],
}

使用变量示例:

$x = $a_string
$y = $an_array[1]
$z = $a_hash['object']

$download_server = 'img2.puppetfans.com'
$url = "https://${download_server}/pkg/puppet-ebook.tar.gz"

$packages = [ 'apache2', 'libapache2-mod-php5', 'libapache2-mod-passenger', ]
package { $packages:
ensure => 'installed'
}