require 'serverspec' set :backend, :exec puts puts '================================' puts %x(ansible --version) puts '================================' describe package('haproxy') do it { should be_installed } end describe file('/etc/haproxy/haproxy.cfg') do it { should be_file } it { should be_mode 640 } it { should be_owned_by 'root' } it { should be_grouped_into 'root' } it { should contain 'server host1 127.0.0.1:443 ssl verify none check maxconn 1000 inter 15s' } end describe file('/etc/haproxy/www-example-com.pem') do it { should be_file } it { should be_mode 600 } it { should be_owned_by 'root' } it { should be_grouped_into 'root' } it { should contain 'test' } end describe service('haproxy') do it { should be_enabled } it { should be_running.under('systemd') } end [80, 5000].each do |port| describe port(port) do it { should be_listening.with('tcp') } end end describe command('haproxy -c -f /etc/haproxy/haproxy.cfg') do its(:exit_status) { should eq 0 } end