You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
action :create do
package 'httpd' do
action :install
end
...
create action continued (website.rb)
...
template "/etc/httpd/conf.d/httpd-#{instance_name}.conf" do
source "httpd.conf.erb"
variables(
:instance_name => instance_name,
:port => port
)
owner 'root'
group 'root'
mode '0644'
action :create
notifies :restart, 'service[httpd]'
end
directory "/var/www/vhosts/#{instance_name}" do
recursive true
owner 'root'
group 'root'
mode '0755'
action :create
notifies :restart, 'service[httpd]'
end
...
finish website.rb
...
file "/var/www/vhosts/#{instance_name}/index.html" do
mode '0644'
content "Ohai! This is the #{instance_name} site running on port #{port}."
action :create
end
service 'httpd' do
action [:enable, :start]
end
end
#recipes/default.rb
mysite 'foo' do
port 81
action :create
end
quick look at .kitchen.yml, remove ubuntu
- name: ubuntu-14.04 <--- take this out
- name: centos-7.1
ok... let's see if this runs
chef install (chefdk 0.9+)
kitchen converge
manual verification
kitchen login
curl localhost:81
manual tests aren't cool, let's serverspec this
# test/integration/default/serverspec/default_spec.rb
require 'spec_helper'
describe port(81) do
it { should be_listening }
end
describe port(82) do
it { should be_listening }
end
run tests!
kitchen verify
add site on port 82 to make test pass - recipes/default.rb
...
mysite 'bar' do
port 82
end
converge and test
kitchen converge
kitchen verify
will this work in centos 6.7? - .kitchen.yml
- name: centos-6.7 <--- add this
- name: centos-7.1