Sha256: f783afcd6914a493ae7ac28eb35c762000ed2d8dc2426c1b9988d4ab1fb6ecec

Contents?: true

Size: 1.67 KB

Versions: 11

Compression:

Stored size: 1.67 KB

Contents

# compliance

apt_update 'packages' do
  action :update
  only_if { node['platform_family'] == 'debian' }
end

append_if_no_line "Add temporary hostsfile entry: #{node['ipaddress']}" do
  path "/etc/hosts"
  line "#{node['ipaddress']} #{node['demo']['domain_prefix']}compliance.#{node['demo']['domain']} compliance"
end

execute 'set hostname' do
  command 'hostnamectl set-hostname compliance'
  action :run
end

directory '/var/opt/chef-compliance'
directory '/var/opt/chef-compliance/ssl'
directory '/var/opt/chef-compliance/ssl/ca'


%w(crt key).each do |ext|
  file "/var/opt/chef-compliance/ssl/ca/#{node['demo']['domain_prefix']}compliance.#{node['demo']['domain']}.#{ext}" do
    content lazy { IO.read("/tmp/compliance.#{ext}") }
    action :create
    sensitive true
  end
end

compliance_server "compliance" do
  package_channel node['demo']['versions']['compliance'].split('-')[0].to_sym
  package_version node['demo']['versions']['compliance'].split('-')[1]
  admin_user 'admin'
  admin_pass node['demo']['users']['admin']['password']
  config node['ccc']['config'].to_hash
  action :install
end

template "/etc/chef-compliance/chef-compliance.rb" do
  source 'chef-compliance.rb.erb'
  variables(
    :name => "#{node['demo']['domain_prefix']}compliance.#{node['demo']['domain']}"
  )
end

1.upto(node['demo']['workstations'].to_i) do |i|
  compliance_user "workstation-#{i}" do
    username "workstation-#{i}"
    password node['demo']['users']["workstation-#{i}"]['password']
  end
end

delete_lines "Remove temporary hostfile entry we added earlier" do
  path "/etc/hosts"
  pattern "^#{node['ipaddress']}.*#{node['demo']['domain_prefix']}compliance\.#{node['demo']['domain']}.*compliance"
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
wombat-cli-0.7.3 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.7.2 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.6.2 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.4.1 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.4.0 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.3.4 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.3.3 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.3.2 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.3.1 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.3.0 generator_files/cookbooks/compliance/recipes/default.rb
wombat-cli-0.2.1 cookbooks/compliance/recipes/default.rb