Skip to content

Instantly share code, notes, and snippets.

@fvoges
Last active March 21, 2019 17:15
Show Gist options
  • Select an option

  • Save fvoges/1d99e8f008927a554093d60d788bce5b to your computer and use it in GitHub Desktop.

Select an option

Save fvoges/1d99e8f008927a554093d60d788bce5b to your computer and use it in GitHub Desktop.
Puppet Practitioner Apache rspec-puppet example using pdk convert
require 'spec_helper'
describe 'apache' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
it { is_expected.to compile }
it {
case facts[:osfamily]
when 'Debian'
pkg_name = 'apache2'
svc_name = 'apache2'
when 'RedHat'
pkg_name = 'httpd'
svc_name = 'httpd'
end
should contain_package('apache').with({
'ensure' => 'present',
'name' => pkg_name,
})
should contain_file('apache_config').with({
'ensure' => 'file',
'source' => "puppet:///modules/apache/#{facts[:osfamily]}.conf",
})
should contain_service('apache').with({
'ensure' => 'running',
'enable' => 'true',
'name' => svc_name,
})
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment