2016-04-04 75 views
0

不是100%確定這是一個木偶問題還是模塊特定的(jfryman/puppet-nginx),但是使用下面的這個puppet代碼,我的目標是保存寫入到配置文件。但它總是替代實際值。其原因的置換爲詳細here如何防止puppet-nginx模塊中的變量替換

$upstream = "http://acme.unix.local" 
nginx::resource::vhost { 'acme.co': 
    listen_port => 8080, 
    server_name => [ 
    'www.acme.co' 
    ], 
    proxy => "$upstream", 
} 

這樣做的目的,

location/{ 
    proxy_pass $upstream; 
} 

不幸的是我得到這個結果,

location/{ 
    proxy_pass http://acme.unix.local; 
} 

回答

3

只需使用單引號:

$upstream = "http://acme.unix.local" 
nginx::resource::vhost { 'acme.co': 
    listen_port => 8080, 
    server_name => ['www.acme.co'], 
    proxy  => '$upstream', 
}