8. describe "OS X Serverの各種設定を確認" do
it "サーバーがスリープしない設定になっていること" do
`sudo systemsetup -getcomputersleep`.chomp.should == "Computer Sleep: Never"
end
it "OS X ServerのVPNサービスが動作していること" do
`sudo serveradmin status vpn | cut -d'"' -f2`.chomp.should == "RUNNING"
end
it "ソフトウェアRAIDの状態がオンラインであること" do
`diskutil listRAID | grep "Status:" | awk '{print $2}' | grep -v
'Online'`.chomp.empty?.should == true
end
end
RSpecでの記述例
11. “With serverspec, you can write RSpec tests for
checking your servers are con?gured correctly.
Serverspec tests your servers' actual state
through SSH access, so you don't need to install
any agent softwares on your servers and can use
any con?guration management tools, Puppet,
Chef, CFEngine and so on.”
http://serverspec.org/
serverspec
15. describe package('serverspec') do
it { should be_installed.by('gem').with_version('0.6.12') }
end
describe ?le('/Volumes/Backups') do
it { should be_mounted }
end
describe ?le('/usr/libexec/upsshutdown') do
it { should be_executable }
it { should be_mode 755 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'wheel' }
end
describe cron do
it { should have_entry '2 4 * * * /usr/bin/fmsadmin restart -y adminserver' }
end
serverspecでの記述例