我一直在尝试自定义一个tomcat主厨配方,但我所做的一切似乎都没有改变tomcat的安装。我使用流浪汉即。
vagrant destroy && vagrant up
在Vagrantfile中
config.vm.provision :chef_solo do |chef|
chef.add_recipe "apt"
chef.add_recipe "nginx-app"
chef.add_recipe "tomcat-app"
end
食谱/ Tomcat的应用程序/食谱/ default.rb
#
# Cookbook Name:: tomcat-app
# Recipe:: default
package "tomcat7" do
action :install
end
食谱/ Tomcat的应用程序/ attributes.rb
node.default["tomcat"]["port"] = 8083 <-- can't seem to make this apply
谢谢,
答案 0 :(得分:1)
我怀疑你正在写自己的tomcat食谱?节点属性覆盖仅适用于此处记录的开源烹饪书:
这是一个利用流浪汉的测试厨房示例。
├── .kitchen.yml
├── Berksfile
└── test
└── integration
├── default
│ └── serverspec
│ └── tomcat_spec.rb
└── roles
└── tomcat.json
&#34; tomcat&#34; role说明了如何设置运行列表并覆盖属性。
---
driver:
name: vagrant
provisioner:
name: chef_zero
platforms:
- name: ubuntu-14.04
suites:
- name: default
run_list:
- role[tomcat]
attributes:
{
"name": "tomcat",
"description": "Runs tomcat with oracle JDK",
"override_attributes": {
"java": {
"jdk_version": 8,
"install_flavor": "oracle",
"oracle": {
"accept_oracle_download_terms": true
}
},
"tomcat": {
"base_version": 7,
"port": 8081
}
},
"run_list": [
"recipe[apt]",
"recipe[java]",
"recipe[tomcat]"
]
}
Berkshelf自动从厨师超市下载食谱。
source 'https://supermarket.chef.io'
cookbook "apt"
cookbook "java"
cookbook "tomcat"
require 'serverspec'
set :backend, :exec
describe service('tomcat7') do
it { should be_running }
end
describe port('8081') do
it { should be_listening }
end
describe process('java') do
it { should be_running }
its(:args) { should match /org.apache.catalina.startup.Bootstrap/ }
end