2016-04-04 8 views
0

Nicht 100% sicher, wenn dies eine Puppe Frage oder Modul spezifisch ist (jfryman/puppet-nginx) aber mit diesem Puppet-Code unten ist mein Ziel, die Variable $ upstream, die in die geschrieben wird Konfigurationsdatei. Es wird jedoch immer der tatsächliche Wert ersetzt. Der Grund für die Substitution detaillierte hereSo verhindern Sie Variablensubstitution in Puppet-Nginx-Modul

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

Dies soll,

location/{ 
    proxy_pass $upstream; 
} 

Leider

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

Antwort

3

Verwenden Sie einfach Apostrophe dieses Ergebnis, erhalte ich:

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