wombat-cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/DESIGN.md +2 -1
  4. data/README.md +10 -32
  5. data/Rakefile +1 -52
  6. data/cookbooks/automate/.kitchen.ec2.yml +8 -1
  7. data/cookbooks/automate/.kitchen.yml +0 -1
  8. data/cookbooks/automate/metadata.rb +0 -2
  9. data/cookbooks/automate/recipes/default.rb +4 -3
  10. data/cookbooks/automate/test/integration/default/automate_spec.rb +3 -2
  11. data/cookbooks/build_node/.kitchen.ec2.yml +8 -1
  12. data/cookbooks/build_node/metadata.rb +0 -3
  13. data/cookbooks/build_node/recipes/default.rb +5 -2
  14. data/cookbooks/build_node/test/integration/default/build-node_spec.rb +3 -2
  15. data/cookbooks/chef_server/.kitchen.ec2.yml +8 -0
  16. data/cookbooks/chef_server/.kitchen.yml +0 -1
  17. data/cookbooks/chef_server/metadata.rb +0 -2
  18. data/cookbooks/chef_server/recipes/{cheffish.rb → bootstrap_users.rb} +1 -1
  19. data/cookbooks/chef_server/recipes/default.rb +30 -14
  20. data/cookbooks/chef_server/test/integration/default/chef_server_spec.rb +7 -4
  21. data/cookbooks/compliance/.kitchen.ec2.yml +8 -0
  22. data/cookbooks/compliance/metadata.rb +0 -1
  23. data/cookbooks/compliance/recipes/default.rb +5 -7
  24. data/cookbooks/compliance/test/integration/default/compliance.rb +3 -2
  25. data/cookbooks/infranodes/.kitchen.ec2.yml +23 -2
  26. data/cookbooks/infranodes/recipes/default.rb +25 -9
  27. data/cookbooks/infranodes/test/fixtures/cookbooks/mock_data/recipes/default.rb +9 -3
  28. data/cookbooks/infranodes/test/integration/default/infranodes_spec.rb +11 -9
  29. data/cookbooks/wombat/attributes/default.rb +2 -0
  30. data/cookbooks/wombat/metadata.rb +2 -0
  31. data/cookbooks/wombat/recipes/authorized-keys.rb +10 -0
  32. data/cookbooks/workstation/recipes/certs-keys.rb +2 -1
  33. data/cookbooks/workstation/templates/default/ssh_config.erb +2 -2
  34. data/lib/wombat/build.rb +138 -120
  35. data/lib/wombat/cli.rb +8 -0
  36. data/lib/wombat/common.rb +27 -12
  37. data/lib/wombat/deploy.rb +33 -26
  38. data/lib/wombat/version.rb +1 -1
  39. data/packer/automate.json +7 -5
  40. data/packer/build-node.json +6 -4
  41. data/packer/chef-server.json +11 -6
  42. data/packer/compliance.json +6 -5
  43. data/packer/infranodes-windows.json +100 -0
  44. data/packer/infranodes.json +6 -5
  45. data/packer/workstation.json +5 -4
  46. data/stacks/.gitkeep +0 -0
  47. data/templates/bootstrap-aws.erb +2 -2
  48. data/templates/cfn.json.erb +16 -15
  49. data/wombat.example.yml +45 -35
  50. metadata +5 -15
  51. data/packer/mock-data/.gitignore +0 -16
  52. data/packer/mock-data/.kitchen.yml +0 -21
  53. data/packer/mock-data/Berksfile +0 -3
  54. data/packer/mock-data/README.md +0 -4
  55. data/packer/mock-data/chefignore +0 -102
  56. data/packer/mock-data/metadata.rb +0 -7
  57. data/packer/mock-data/recipes/default.rb +0 -69
  58. data/packer/mock-data/spec/spec_helper.rb +0 -2
  59. data/packer/mock-data/spec/unit/recipes/default_spec.rb +0 -20
  60. data/packer/mock-data/test/integration/default/serverspec/default_spec.rb +0 -9
  61. data/packer/mock-data/test/integration/helpers/serverspec/spec_helper.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b93d81468007c7e0f2eacebc5b8d7a623f4ef2b
4
- data.tar.gz: 22e16911954777a777d741f65e190a094479fb41
3
+ metadata.gz: ca6a1a2f8fb637c2d25dd3126f74592d8112e1e7
4
+ data.tar.gz: 957f61652039515b6f3a072f0846b02e8d195c2a
5
5
  SHA512:
6
- metadata.gz: e4639618f0e1555f2d830840fd3b74b9c761759b50bbe23710fd37fd320e4367249137d4d2f1b40aee5c25c72591ac4426f10a4b89c2018d5678edd2118f5acd
7
- data.tar.gz: 2bc93afb35e83966a233564c2b7b5b4704d629c7633bbe6d129ba7ca7bcfe4b00325bde9df3128417322e5a66e06cc165f18a291af5421af6553e2388c3638c2
6
+ metadata.gz: 81f88a7148288add492bf6026bfdc22a13d3f7b607d65ffc3fe30e606a4b451320a46fc27696c58fb769974ac7a8d462dd07795d3e85953dee48ab76f1bae722
7
+ data.tar.gz: 47b7e2ff045a4b939c4ab83f5251bfdbd24021278fe62fc7eb4178fa4d23310651f9566b14fbadea7727be5a0492c5171c4e5080feadc419646db4b9609f1de3
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ infranodes-info.json
17
17
  output
18
18
  bootstrap-aws.txt
19
19
  *.gem
20
+ stacks/*
data/DESIGN.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Anatomy of an Wombat
1
+ ## Anatomy of a Wombat
2
2
 
3
3
  ### tl;dr
4
4
 
@@ -11,6 +11,7 @@ as CloudFormation or Google Deployment Manager.
11
11
  * coordination without coordination
12
12
  * principle of least surprise
13
13
  * dynamic templates over static files
14
+ * long build times, short deploy times
14
15
 
15
16
  ### A Stroll Down Architecture Lane
16
17
 
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  [![Stories in Ready](https://badge.waffle.io/chef-cft/wombat.png?label=ready&title=Ready)](https://waffle.io/chef-cft/wombat)
2
2
  # `Project Wombat`
3
- A combination of packer templates and terraform plan to configure a demo environment which includes:
3
+ `wombat` is a gem that builds and creates demo environments using cloud-specific deployment
4
+ tools like CloudFormation. The demo environments are comprised of instances built
5
+ from the included packer templates:
4
6
 
5
7
  * Chef Server
6
8
  * Chef Automate
@@ -9,7 +11,6 @@ A combination of packer templates and terraform plan to configure a demo environ
9
11
  * _N_ Infrastructure Nodes
10
12
  * _N_ Windows Workstation
11
13
 
12
-
13
14
  Usage
14
15
  ------------
15
16
 
@@ -23,7 +24,7 @@ directory.
23
24
 
24
25
  ##### Install and Configure ChefDK
25
26
 
26
- Follow the instructions at https://docs.chef.io/install_dk.html to install and configure ChefDK as your default version of ruby.
27
+ Follow the instructions at https://docs.chef.io/install_dk.html to install and configure ChefDK as your default version of Ruby.
27
28
 
28
29
  ##### Install Packer
29
30
 
@@ -32,34 +33,6 @@ Downloads are here: https://www.packer.io/downloads.html . Place in your path fo
32
33
  ##### Create a wombat.yml
33
34
 
34
35
  Create a wombat.yml - there is an example `wombat.example.yml` for reference and easy copying
35
- ```
36
- ---
37
- name: wombat
38
- # Uncomment domain_prefix if you wish to prepend your generated domain.
39
- # Ex: The below example would create foo-chef.animals.biz.
40
- # domain_prefix: foo-
41
- domain: animals.biz
42
- enterprise: mammals
43
- org: marsupials
44
- build-nodes: '1'
45
- workstations: '1'
46
- workstation-passwd: 'RL9@T40BTmXh'
47
- version: 0.2.0
48
- ttl: 8
49
- products:
50
- chef: stable-12.13.37
51
- chef-server: stable-12.8.0
52
- chefdk: stable-0.16.28
53
- compliance: stable-1.3.1
54
- automate: stable-0.5.1
55
- aws:
56
- region: ap-southeast-2
57
- az: ap-southeast-2c
58
- keypair: keypair-ap-southeast-2
59
- source_ami:
60
- ubuntu: ami-8c4cb0ec
61
- windows: ami-87c037e7
62
- ```
63
36
 
64
37
  *NOTE:* workstation-passwd must meet the minimum Microsoft [Complexity Requirements](https://technet.microsoft.com/en-us/library/hh994562(v=ws.11).aspx)
65
38
 
@@ -90,13 +63,18 @@ Upload the created template from the `cloudformation` directory.
90
63
 
91
64
  ```
92
65
  # Deploy CloudFormation template
93
- $ bin/wombat deploy --cloud aws STACK
66
+ $ bin/wombat deploy --cloud aws STACK --update-lock --create-template
94
67
  ==> Updating wombat.lock
95
68
  ==> Generate CloudFormation JSON: STACK.json
96
69
  ==> Creating CloudFormation stack
97
70
  Created: arn:aws:cloudformation:us-east-1:862552916454:stack/STACK/2160c580-713e-11e6-b392-50a686e4bb82
98
71
  ```
99
72
 
73
+ ```
74
+ # Deploy an already generated template (pre-existing template)
75
+ bin/wombat deploy --cloud aws STACK
76
+ ```
77
+
100
78
  *NOTE:* If the cloud is not provided it defaults to `aws`
101
79
 
102
80
  ##### Login to Windows Workstation
data/Rakefile CHANGED
@@ -1,52 +1 @@
1
- require 'erb'
2
- require 'json'
3
- require 'openssl'
4
- require 'net/ssh'
5
- require 'yaml'
6
- require 'parallel'
7
- require 'aws-sdk'
8
-
9
- namespace :build do
10
- desc 'Build an image'
11
- task :image, :template, :builder do |_t, args|
12
- sh "bin/wombat build -o #{args[:builder]} #{args[:template]}"
13
- end
14
-
15
- desc 'Build all images'
16
- task :images, :builder, :parallel do |_t, args|
17
- if parallel == 'true'
18
- sh "bin/wombat build -o #{args[:builder]} --parallel"
19
- else
20
- sh "bin/wombat build -o #{args[:builder]}"
21
- end
22
- end
23
- end
24
-
25
- namespace :deploy do
26
- desc 'Deploy a stack from template'
27
- task :create, :stack,:cloud do |_t, args|
28
- case args[:cloud]
29
- when "gce", "gcp", "google", "gdm"
30
- # TODO
31
- when "aws", "amazon", "jeffbezosband", "cfn"
32
- sh "bin/wombat deploy --cloud aws #{args[:stack]}"
33
- end
34
- end
35
-
36
- desc 'Delete a stack'
37
- task :delete, :stack, :cloud do |task, args|
38
- cloud = args[:cloud] == 'gcp' ? 'gcp' : 'aws'
39
- sh "bin/wombat delete --cloud #{cloud} #{args[:stack]}"
40
- end
41
-
42
- desc 'List workstation IPs of a stack'
43
- task :outputs, :stack, :cloud do |task, args|
44
- cloud = args[:cloud] == 'gcp' ? 'gcp' : 'aws'
45
- case cloud
46
- when "gce", "gcp", "google", "gdm"
47
- puts "do google shit"
48
- when "aws", "amazon", "jeffbezosband", "cfn"
49
- sh "bin/wombat outputs --cloud aws #{args[:stack]}"
50
- end
51
- end
52
- end
1
+ require 'bundler/gem_tasks'
@@ -18,10 +18,17 @@ platforms:
18
18
  image_id: ami-8e0b9499
19
19
  transport:
20
20
  ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
+ - name: centos-7
22
+ driver:
23
+ image_id: ami-6d1c2007
24
+ transport:
25
+ username: centos
26
+ ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
27
 
22
28
  suites:
23
29
  - name: default
24
30
  run_list:
25
- - recipe[apt]
26
31
  - recipe[mock_data]
27
32
  - recipe[automate]
33
+ - recipe[wombat::authorized-keys]
34
+ - recipe[wombat::etc-hosts]
@@ -17,7 +17,6 @@ platforms:
17
17
  suites:
18
18
  - name: default
19
19
  run_list:
20
- - recipe[apt::default]
21
20
  - recipe[mock_data::default]
22
21
  - recipe[automate::default]
23
22
  attributes:
@@ -6,8 +6,6 @@ description 'Installs/Configures automate'
6
6
  long_description 'Installs/Configures automate'
7
7
  version '0.2.0'
8
8
 
9
- depends 'apt'
10
9
  depends 'chef-ingredient'
11
- depends 'hostsfile'
12
10
  depends 'line'
13
11
  depends 'wombat'
@@ -3,6 +3,10 @@
3
3
  # Recipe:: default
4
4
  #
5
5
  # Copyright (c) 2016 The Authors, All Rights Reserved.
6
+ apt_update 'packages' do
7
+ action :update
8
+ only_if { node['platform_family'] == 'debian' }
9
+ end
6
10
 
7
11
  append_if_no_line "Add temporary hostsfile entry: #{node['ipaddress']}" do
8
12
  path "/etc/hosts"
@@ -106,6 +110,3 @@ delete_lines "Remove temporary hostfile entry we added earlier" do
106
110
  path "/etc/hosts"
107
111
  pattern "^#{node['ipaddress']}.*#{node['demo']['automate_fqdn']}.*automate"
108
112
  end
109
-
110
- include_recipe 'wombat::authorized-keys'
111
- include_recipe 'wombat::etc-hosts'
@@ -9,8 +9,9 @@ describe file('/usr/local/bin/jq') do
9
9
  it { should be_executable }
10
10
  end
11
11
 
12
- describe file('/home/vagrant/.ssh/authorized_keys') do
13
- its('content') { file("/tmp/public.pub").content }
12
+ describe file("/home/#{os.name}/.ssh/authorized_keys") do
13
+ its('content') { should include file("/tmp/public.pub").content }
14
+ it { should exist }
14
15
  end
15
16
 
16
17
  describe package('delivery') do
@@ -18,13 +18,20 @@ platforms:
18
18
  image_id: ami-8e0b9499
19
19
  transport:
20
20
  ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
+ - name: centos-7
22
+ driver:
23
+ image_id: ami-6d1c2007
24
+ transport:
25
+ username: centos
26
+ ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
27
 
22
28
  suites:
23
29
  - name: default
24
30
  run_list:
25
- - recipe[apt]
26
31
  - recipe[mock_data]
27
32
  - recipe[build_node]
33
+ - recipe[wombat::authorized-keys]
34
+ - recipe[wombat::etc-hosts]
28
35
  attributes:
29
36
  demo:
30
37
  node-number: '1'
@@ -6,10 +6,7 @@ description 'Installs/Configures build-node'
6
6
  long_description 'Installs/Configures build-node'
7
7
  version '0.3.0'
8
8
 
9
- depends 'apt'
10
9
  depends 'chef-sugar'
11
10
  depends 'delivery-base'
12
11
  depends 'delivery_build'
13
- depends 'hostsfile'
14
- depends 'line'
15
12
  depends 'wombat'
@@ -3,6 +3,10 @@
3
3
  # Recipe:: default
4
4
  #
5
5
  # Copyright (c) 2016 The Authors, All Rights Reserved.
6
+ apt_update 'packages' do
7
+ action :update
8
+ only_if { node['platform_family'] == 'debian' }
9
+ end
6
10
 
7
11
  directory '/etc/chef'
8
12
  directory '/etc/chef/trusted_certs'
@@ -30,6 +34,5 @@ end
30
34
 
31
35
  node.set['push_jobs']['chef']['chef_server_url'] = node['demo']['chef_server_url']
32
36
  node.set['push_jobs']['chef']['node_name'] = "build-node-#{node['demo']['node-number']}"
33
- include_recipe 'wombat::authorized-keys'
34
- include_recipe 'wombat::etc-hosts'
37
+
35
38
  include_recipe 'delivery_build::default'
@@ -1,7 +1,8 @@
1
1
  # build-node tests
2
2
 
3
- describe file('/home/vagrant/.ssh/authorized_keys') do
4
- its('content') { file("/tmp/private.pem").content }
3
+ describe file("/home/#{os.name}/.ssh/authorized_keys") do
4
+ its('content') { should include file("/tmp/public.pub").content }
5
+ it { should exist }
5
6
  end
6
7
 
7
8
  %w(chef automate compliance).each do |hostname|
@@ -18,9 +18,17 @@ platforms:
18
18
  image_id: ami-8e0b9499
19
19
  transport:
20
20
  ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
+ - name: centos-7
22
+ driver:
23
+ image_id: ami-6d1c2007
24
+ transport:
25
+ username: centos
26
+ ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
27
 
22
28
  suites:
23
29
  - name: default
24
30
  run_list:
25
31
  - recipe[mock_data]
26
32
  - recipe[chef_server]
33
+ - recipe[wombat::authorized-keys]
34
+ - recipe[wombat::etc-hosts]
@@ -17,7 +17,6 @@ platforms:
17
17
  suites:
18
18
  - name: default
19
19
  run_list:
20
- - recipe[apt]
21
20
  - recipe[mock_data]
22
21
  - recipe[chef_server]
23
22
  attributes:
@@ -6,8 +6,6 @@ description 'Installs/Configures chef-server'
6
6
  long_description 'Installs/Configures chef-server'
7
7
  version '0.3.0'
8
8
 
9
- depends 'apt'
10
9
  depends 'chef-ingredient', '>= 0.18.5'
11
- depends 'hostsfile'
12
10
  depends 'line'
13
11
  depends 'wombat'
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Cookbook Name:: chef-server
3
- # Recipe:: default
3
+ # Recipe:: bootstrap_users
4
4
  #
5
5
  # Copyright (c) 2016 The Authors, All Rights Reserved.
6
6
 
@@ -4,6 +4,11 @@
4
4
  #
5
5
  # Copyright (c) 2016 The Authors, All Rights Reserved.
6
6
 
7
+ apt_update 'packages' do
8
+ action :update
9
+ only_if { node['platform_family'] == 'debian' }
10
+ end
11
+
7
12
  append_if_no_line "Add temporary hostsfile entry: #{node['ipaddress']}" do
8
13
  path "/etc/hosts"
9
14
  line "#{node['ipaddress']} #{node['demo']['domain_prefix']}chef.#{node['demo']['domain']} chef"
@@ -14,11 +19,6 @@ execute 'set hostname' do
14
19
  action :run
15
20
  end
16
21
 
17
- append_if_no_line "Add certificate to authorized_keys" do
18
- path "/home/#{node['demo']['admin-user']}/.ssh/authorized_keys"
19
- line lazy { IO.read('/tmp/public.pub') }
20
- end
21
-
22
22
  directory '/var/opt/opscode'
23
23
  directory '/var/opt/opscode/nginx'
24
24
  directory '/var/opt/opscode/nginx/ca'
@@ -44,10 +44,28 @@ chef_ingredient 'chef-server' do
44
44
  config "api_fqdn 'chef.#{node['demo']['domain']}'"
45
45
  end
46
46
 
47
- chef_ingredient 'push-jobs-server' do
48
- channel :stable
49
- version :latest
50
- action :install
47
+ if node['platform'] == 'centos'
48
+ # hardcoding this one as other permutations are known broken
49
+ filename = 'opscode-push-jobs-server-1.1.6-1.x86_64.rpm'
50
+ rpm_path = File.join(Chef::Config[:file_cache_path], filename)
51
+
52
+ remote_file rpm_path do
53
+ source "https://packages.chef.io/stable/el/6/#{filename}"
54
+ action :create_if_missing
55
+ notifies :install, 'rpm_package[push-jobs-server]', :immediately
56
+ end
57
+
58
+ rpm_package 'push-jobs-server' do
59
+ action :install
60
+ source rpm_path
61
+ #not_if ""
62
+ end
63
+ else
64
+ chef_ingredient 'push-jobs-server' do
65
+ channel node['demo']['versions']['push-jobs-server'].split('-')[0].to_sym
66
+ version node['demo']['versions']['push-jobs-server'].split('-')[1]
67
+ action :install
68
+ end
51
69
  end
52
70
 
53
71
  chef_ingredient 'push-jobs-server' do
@@ -55,8 +73,8 @@ chef_ingredient 'push-jobs-server' do
55
73
  end
56
74
 
57
75
  chef_ingredient 'manage' do
58
- channel :stable
59
- version :latest
76
+ channel node['demo']['versions']['manage'].split('-')[0].to_sym
77
+ version node['demo']['versions']['manage'].split('-')[1]
60
78
  action :install
61
79
  end
62
80
 
@@ -69,11 +87,9 @@ chef_ingredient 'manage' do
69
87
  action :reconfigure
70
88
  end
71
89
 
72
- include_recipe 'chef_server::cheffish'
90
+ include_recipe 'chef_server::bootstrap_users'
73
91
 
74
92
  delete_lines "Remove temporary hostfile entry we added earlier" do
75
93
  path "/etc/hosts"
76
94
  pattern "^#{node['ipaddress']}.*#{node['demo']['domain_prefix']}chef\.#{node['demo']['domain']}.*chef"
77
95
  end
78
-
79
- include_recipe 'wombat::etc-hosts'
@@ -4,8 +4,9 @@ describe command('hostname') do
4
4
  its('stdout') { should eq "chef\n" }
5
5
  end
6
6
 
7
- describe file('/home/vagrant/.ssh/authorized_keys') do
8
- its('content') { file("/tmp/public.pub").content }
7
+ describe file("/home/#{os.name}/.ssh/authorized_keys") do
8
+ its('content') { should include file("/tmp/public.pub").content }
9
+ it { should exist }
9
10
  end
10
11
 
11
12
  describe package('chef-server-core') do
@@ -15,12 +16,14 @@ end
15
16
 
16
17
  describe package('chef-manage') do
17
18
  it { should be_installed }
18
- its('version') { should match '2.4.2' }
19
+ its('version') { should match '2.4.3' }
19
20
  end
20
21
 
22
+ version = os.debian? ? '2.1.0' : '1.1.6'
23
+
21
24
  describe package('opscode-push-jobs-server') do
22
25
  it { should be_installed }
23
- its('version') { should match '2.1.0' }
26
+ its('version') { should match version }
24
27
  end
25
28
 
26
29
  describe command('chef-server-ctl org-list') do
@@ -18,9 +18,17 @@ platforms:
18
18
  image_id: ami-8e0b9499
19
19
  transport:
20
20
  ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
+ - name: centos-7
22
+ driver:
23
+ image_id: ami-6d1c2007
24
+ transport:
25
+ username: centos
26
+ ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
27
 
22
28
  suites:
23
29
  - name: default
24
30
  run_list:
25
31
  - recipe[mock_data]
26
32
  - recipe[compliance]
33
+ - recipe[wombat::authorized-keys]
34
+ - recipe[wombat::etc-hosts]
@@ -6,7 +6,6 @@ description 'Installs/Configures compliance'
6
6
  long_description 'Installs/Configures compliance'
7
7
  version '0.2.0'
8
8
 
9
- depends 'apt'
10
9
  depends 'ccc'
11
10
  depends 'wombat'
12
11
  depends 'line'
@@ -1,5 +1,10 @@
1
1
  # compliance
2
2
 
3
+ apt_update 'packages' do
4
+ action :update
5
+ only_if { node['platform_family'] == 'debian' }
6
+ end
7
+
3
8
  append_if_no_line "Add temporary hostsfile entry: #{node['ipaddress']}" do
4
9
  path "/etc/hosts"
5
10
  line "#{node['ipaddress']} #{node['demo']['domain_prefix']}compliance.#{node['demo']['domain']} compliance"
@@ -10,11 +15,6 @@ execute 'set hostname' do
10
15
  action :run
11
16
  end
12
17
 
13
- append_if_no_line "Add certificate to authorized_keys" do
14
- path "/home/#{node['demo']['admin-user']}/.ssh/authorized_keys"
15
- line lazy { IO.read('/tmp/public.pub') }
16
- end
17
-
18
18
  directory '/var/opt/chef-compliance'
19
19
  directory '/var/opt/chef-compliance/ssl'
20
20
  directory '/var/opt/chef-compliance/ssl/ca'
@@ -55,5 +55,3 @@ delete_lines "Remove temporary hostfile entry we added earlier" do
55
55
  path "/etc/hosts"
56
56
  pattern "^#{node['ipaddress']}.*#{node['demo']['domain_prefix']}compliance\.#{node['demo']['domain']}.*compliance"
57
57
  end
58
-
59
- include_recipe 'wombat::etc-hosts'
@@ -4,8 +4,9 @@ describe command('hostname') do
4
4
  its('stdout') { should eq "compliance\n" }
5
5
  end
6
6
 
7
- describe file('/home/vagrant/.ssh/authorized_keys') do
8
- its('content') { file("/tmp/public.pub").content }
7
+ describe file("/home/#{os.name}/.ssh/authorized_keys") do
8
+ its('content') { should include file("/tmp/public.pub").content }
9
+ it { should exist }
9
10
  end
10
11
 
11
12
  describe package('chef-compliance') do
@@ -4,7 +4,9 @@ driver:
4
4
  aws_ssh_key_id: <%= ENV["EC2_SSH_KEY_NAME"] %>
5
5
  region: us-east-1
6
6
  availability_zone: e
7
- instance_type: m3.large
7
+ instance_type: m4.large
8
+ retryable_sleep: 10
9
+ retryable_tries: 60
8
10
 
9
11
  provisioner:
10
12
  name: chef_zero
@@ -13,15 +15,34 @@ verifier:
13
15
  name: inspec
14
16
 
15
17
  platforms:
18
+ - name: centos-7
19
+ driver:
20
+ image_id: ami-6d1c2007
21
+ transport:
22
+ username: centos
23
+ ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
24
+ attributes:
25
+ demo:
26
+ admin-user: 'centos'
16
27
  - name: ubuntu-1404
17
28
  driver:
18
29
  image_id: ami-8e0b9499
19
30
  transport:
20
31
  ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
32
+ attributes:
33
+ demo:
34
+ admin-user: 'ubuntu'
35
+ - name: windows-2012r2
36
+ driver:
37
+ security_group_ids: ['sg-13f69876']
38
+ image_id: ami-bd3ba0aa
39
+ transport:
40
+ ssh_key: <%= ENV["EC2_SSH_KEY_PATH"] %>
21
41
 
22
42
  suites:
23
43
  - name: default
24
44
  run_list:
25
- - recipe[apt]
26
45
  - recipe[mock_data]
27
46
  - recipe[infranodes]
47
+ - recipe[wombat::authorized-keys]
48
+ - recipe[wombat::etc-hosts]
@@ -4,15 +4,31 @@
4
4
  #
5
5
  # Copyright (c) 2016 The Authors, All Rights Reserved.
6
6
 
7
+ if node['platform'] == 'windows'
8
+ node.default['push_jobs']['package_url'] = "https://packages.chef.io/stable/windows/2008r2/push-jobs-client-2.1.1-1-x86.msi"
9
+ node.default['push_jobs']['package_checksum'] = "b8e76d54bb931949bcc94a6c764ccebda0e6957820b0c3fe62c96e6c3a184d9f"
10
+
11
+ conf_dir = "C:/chef"
12
+ tmp_dir = "C:/Windows/Temp"
13
+ else
14
+ conf_dir = "/etc/chef"
15
+ tmp_dir = "/tmp"
16
+
17
+ apt_update 'packages' do
18
+ action :update
19
+ only_if { node['platform_family'] == 'debian' }
20
+ end
21
+ end
22
+
7
23
  chef_ingredient 'chef' do
8
24
  channel node['demo']['versions']['chef'].split('-')[0].to_sym
9
25
  version node['demo']['versions']['chef'].split('-')[1]
10
26
  action :install
11
27
  end
12
28
 
13
- directory '/etc/chef'
29
+ directory conf_dir
14
30
 
15
- template '/etc/chef/client.rb' do
31
+ template File.join(conf_dir, 'client.rb') do
16
32
  source 'client.rb.erb'
17
33
  variables({
18
34
  :chef_server_url => node['demo']['chef_server_url'],
@@ -21,21 +37,21 @@ template '/etc/chef/client.rb' do
21
37
  })
22
38
  end
23
39
 
24
- file '/etc/chef/client.pem' do
25
- content lazy { IO.read('/tmp/private.pem') }
40
+ file File.join(conf_dir, 'client.pem') do
41
+ content lazy { IO.read(File.join(tmp_dir, 'private.pem')) }
26
42
  end
27
43
 
28
44
  ###todo: centralize this into the wombat cookbook
29
- directory '/etc/chef/trusted_certs'
45
+ directory File.join(conf_dir, 'trusted_certs')
30
46
 
31
47
  %w(chef automate compliance).each do |f|
32
- file "/etc/chef/trusted_certs/#{node['demo']['domain_prefix']}#{f}_#{node['demo']['domain'].tr('.','_')}.crt" do
33
- content lazy { IO.read("/tmp/#{f}.crt") }
48
+ file File.join(conf_dir, "trusted_certs/#{node['demo']['domain_prefix']}#{f}_#{node['demo']['domain'].tr('.','_')}.crt") do
49
+ content lazy { IO.read(File.join(tmp_dir, "#{f}.crt")) }
34
50
  end
35
51
  end
36
52
  ###
37
53
  node.set['push_jobs']['chef']['chef_server_url'] = node['demo']['chef_server_url']
38
54
  node.set['push_jobs']['chef']['node_name'] = node['demo']['node-name']
39
- include_recipe 'wombat::authorized-keys'
40
- include_recipe 'wombat::etc-hosts'
55
+ node.default['push_jobs']['allow_unencrypted'] = true
56
+
41
57
  include_recipe 'push-jobs'
@@ -1,18 +1,24 @@
1
1
  # copy files into tmp for cookbook
2
2
 
3
- cookbook_file '/tmp/public.pub' do
3
+ if node['platform'] == 'windows'
4
+ tmp_dir = "C:/Windows/Temp"
5
+ else
6
+ tmp_dir = "/tmp"
7
+ end
8
+
9
+ cookbook_file File.join(tmp_dir, 'public.pub') do
4
10
  content 'public.pub'
5
11
  action :create
6
12
  end
7
13
 
8
- cookbook_file '/tmp/private.pem' do
14
+ cookbook_file File.join(tmp_dir, 'private.pem') do
9
15
  content 'private.pem'
10
16
  action :create
11
17
  end
12
18
 
13
19
  %w(chef automate compliance).each do |f|
14
20
  %w(crt key).each do |ext|
15
- cookbook_file "/tmp/#{f}.#{ext}" do
21
+ cookbook_file File.join(tmp_dir, "#{f}.crt") do
16
22
  content "#{f}.#{ext}"
17
23
  action :create
18
24
  sensitive true