我正在开发一个节点集群。在myrepo/cookbooks/mycookbook/.kitchen.yml
我有
driver:
name: vagrant
provisioner:
name: chef_zero
roles_path: '../../roles'
environments_path: '../../environments'
data_bags_path: '../../data_bags'
platforms:
- name: ubuntu-12.04
suites:
- name: node01
driver:
vm_hostname: "node01.localhost"
run_list:
- role[genericnode]
provisioner:
client_rb:
environment: development
在myrepo/cookbooks/mycookbook/recipes/default.rb
我有
nodes = []
search(:node, 'role:genericnode').each do |node|
nodes.push("http://#{node['ipaddress']}:8080")
end
node.default['mysetting'] = nodes.join(',')
但是,在我的开发环境中,搜索返回一个空列表。我是否需要超过上述.kitchen.yml
设置才能访问我的网络中具有该角色的节点的 IP 地址genericnode
?
附加信息:
这是角色:
{
"name": "genericnode",
"description": "Generic Node",
"json_class": "Chef::Role",
"default_attributes": {
},
"override_attributes": {
},
"chef_type": "role",
"run_list": [
"recipe[apt::default]", "recipe[mycookbook::default]"
],
"env_run_lists": {
}
}