【发布时间】:2015-11-21 04:33:06
【问题描述】:
我们的一个应用使用 gunicorn 并通过厨师食谱进行配置。
cookbook 有一些属性,其中之一是 gunicorn 版本:
grep 'version' attributes/default.rb
default['myapp']['gunicorn']['version'] = '19.1.1'
仅当节点是特定角色的一部分时,我才想使用版本 19.3.0。我创建了一个角色并赋予了它一个属性:
cat ../../roles/gunicorn-19.3.0.rb
name 'gunicorn-19.3.0'
default_attributes(
'mcnulty' => {
'gunicorn' => {
'version' => '19.3.0'
}
}
)
鉴于角色属性优先于说明书属性,这应该有效。对吧??
现在我想用厨房来测试一下。在我们的kichen.yml 中,我们已经有一个default 套件,我复制并创建了一个gunicorn-19.3.0 套件:
- name: gunicorn-19.3.0
roles_path: '../../roles'
run_list:
- recipe[apt]
- recipe[build-essential]
- recipe[myapp]
attributes: &attributes
myapp:
gunicorn:
query:
timeout: 5
workers: 2
sockdir: /var/run/myapp
web:
timeout: 5
workers: 2
sockdir: /var/run/myapp
现在我无法弄清楚如何模仿这个主机是gunicorn-19.3.0 角色的一部分的事实......
感谢任何帮助。
最好的。
【问题讨论】: