我正在給jfryman的nginx模塊寫一些擴展。木偶變量的繼承,包括要求?
我有許多已nginx的安裝服務器,並有不同的地點:
例如
Live = site1.domain
Staging = site1.staging.domain
Development = site1.development.domain, site2.development.domain, site3.development.domain (etc)
所以,救我的理智,我已經創造了一些模塊 「額外」 的文件,每個文件:即,模塊/ nginx的/艙單/ amcustom/site1.pp等
現在 - 所有這些網站都包含Nginx的自定義配置,所以爲了不讓我重複相同的代碼,我創建了以下內容作爲變量的「模板」 - 它被稱爲〜/ modules/nginx/manifests/amcustom/ux_std_vhost.pp和包含:
class nginx::amcustom::ux_std_vhost {
file { $nginx_dirs:
ensure => 'directory',
owner => 'gitpull',
group => 'www-data',
mode => 0750,
}
nginx::resource::vhost { "${webshortname}.${domain}":
ensure => present,
rewrite_to_https => true,
www_root => "${full_web_path}/${webshortname}.${domain}/latest/",
index_files => [ 'index.html' ],
location_cfg_append => $location_cfg_append,
ssl => true,
ssl_cert => "puppet:///modules/nginx/$webshortname.$domain.nginx.crt",
ssl_key => "puppet:///modules/nginx/$webshortname.$domain.key",
ssl_protocols => 'TLSv1 TLSv1.1 TLSv1.2',
ssl_ciphers => '"EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH !EDH+aRSA !RC4 !a
NULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"',
vhost_cfg_ssl_prepend => {
'add_header' => '"Strict-Transport-Security" "max-age=15768000"'
},
location_raw_append => [ 'if ($http_origin ~* (https?://[^/]*\.domain(:[0-9]+)?)) {', 'add_header "Access-Control-Allow-Origin" "$http_origin";', '}' ],
}
}
我需要做的 - 就是使用這一個「標準」文件,並通過我對於每個站點的牛逼變量:
~/amcustom/site1.pp
~/amcustom/site2.pp
...etc
這些配置文件的內容將是:
class nginx::amcustom::site1_config inherits nginx::amcustom::ux_std_vhost {
# Define my Variables:
$full_web_path = [ '/var/sites' ]
$webshortname = [ 'site1' ]
$domain = [ 'domain' ]
$location_cfg_append = undef
$nginx_dirs = [ "$full_web_path/", "$full_web_path/$webshortname.$domain/" ]
}
class nginx::amcustom::site1 {
include ::nginx,nginx::amcustom::site1_config
require users::amcustom::gitpull_ux
}
的問題,我是,我已指定沒有得到過我的課的變量(詳細的nginx ::資源::虛擬主機)和報告的錯誤是:
puppet-agent[20280]: Failed to apply catalog: Parameter path failed on File[undef]: File paths must be fully qualified, not 'undef' at /etc/puppet/environments/development/modules/nginx/manifests/amcustom/ux_std_vhost.pp:8
木偶文件正在融化我的頭這一點,所以一些容易理解的幫助真的會的欣賞編輯。
TIA。
AM