mixlib-install 1.2.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +41 -0
  3. data/CHANGELOG.md +6 -2
  4. data/README.md +4 -15
  5. data/Rakefile +2 -12
  6. data/acceptance/.gitignore +7 -1
  7. data/acceptance/Gemfile +0 -8
  8. data/acceptance/README.md +6 -0
  9. data/acceptance/bourne/.acceptance/acceptance-cookbook/.gitignore +8 -0
  10. data/acceptance/{unstable → bourne}/.acceptance/acceptance-cookbook/metadata.rb +1 -0
  11. data/acceptance/bourne/.acceptance/acceptance-cookbook/recipes/destroy.rb +3 -0
  12. data/acceptance/bourne/.acceptance/acceptance-cookbook/recipes/provision.rb +11 -0
  13. data/acceptance/bourne/.acceptance/acceptance-cookbook/recipes/verify.rb +11 -0
  14. data/acceptance/bourne/inspec/verify.rb +3 -0
  15. data/acceptance/bourne/terraform/application.tf +78 -0
  16. data/acceptance/bourne/terraform/aws.tf +8 -0
  17. data/acceptance/bourne/terraform/variables.tf +27 -0
  18. data/acceptance/{current → powershell}/.acceptance/acceptance-cookbook/.gitignore +1 -1
  19. data/acceptance/{current → powershell}/.acceptance/acceptance-cookbook/metadata.rb +1 -0
  20. data/acceptance/powershell/.acceptance/acceptance-cookbook/recipes/destroy.rb +3 -0
  21. data/acceptance/powershell/.acceptance/acceptance-cookbook/recipes/provision.rb +12 -0
  22. data/acceptance/powershell/.acceptance/acceptance-cookbook/recipes/verify.rb +12 -0
  23. data/acceptance/powershell/inspec/verify.rb +3 -0
  24. data/acceptance/powershell/terraform/application.tf +89 -0
  25. data/acceptance/powershell/terraform/aws.tf +8 -0
  26. data/acceptance/powershell/terraform/variables.tf +16 -0
  27. data/ci/before-script.sh +31 -0
  28. data/ci/es-infrastructure.pem.enc +0 -0
  29. data/lib/mixlib/install.rb +0 -10
  30. data/lib/mixlib/install/backend.rb +2 -7
  31. data/lib/mixlib/install/backend/{artifactory.rb → package_router.rb} +52 -100
  32. data/lib/mixlib/install/generator/base.rb +1 -2
  33. data/lib/mixlib/install/generator/bourne.rb +1 -13
  34. data/lib/mixlib/install/generator/powershell.rb +2 -25
  35. data/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb +1 -1
  36. data/lib/mixlib/install/options.rb +3 -17
  37. data/lib/mixlib/install/script_generator.rb +1 -0
  38. data/lib/mixlib/install/version.rb +1 -1
  39. data/mixlib-install.gemspec +4 -3
  40. metadata +51 -32
  41. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
  42. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -3
  43. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -3
  44. data/acceptance/current/.kitchen.yml +0 -41
  45. data/acceptance/unstable/.acceptance/acceptance-cookbook/.gitignore +0 -2
  46. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
  47. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -3
  48. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -3
  49. data/acceptance/unstable/.kitchen.yml +0 -41
  50. data/config.ru +0 -7
  51. data/lib/mixlib/install/backend/bintray.rb +0 -298
  52. data/lib/mixlib/install/backend/omnitruck.rb +0 -75
  53. data/lib/mixlib/install/generator/bourne/scripts/artifactory_urls.sh.erb +0 -28
  54. data/lib/mixlib/install/generator/powershell/scripts/get_project_metadata_for_artifactory.ps1.erb +0 -75
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31d7f4084fe55fca11da584264045f2360973d2a
4
- data.tar.gz: 505328fca2bfba3c7e52ae7c5144ffd942576a49
3
+ metadata.gz: d396bf37f1b50052a6d6550a76dd2e830466f42b
4
+ data.tar.gz: c5ebe8fe43866d0dc9cdf737b3786b355eed9da3
5
5
  SHA512:
6
- metadata.gz: 600a348d941118e4cd3418e13522a33b844e1645d9e979c327f01911c9f400a0e57ddc0be320d85a139e26cbdfce40c225bfc6bc419a257bb884edc27fcc020b
7
- data.tar.gz: ac9e249c233af533a9c82d396b4b3ebeb8390320302ec6927016f710a8e88172c9bed92199c3088001ed2f9ca2af34c67cefae6078492580352f1fd46589732a
6
+ metadata.gz: ea784db481d70828c8d176717453c28837631c265c9bb4227c922bc53ede996c0a8391b9badf2bc508d52da20fa3f91dcf2136af97f1ee5cc4239b0c9e932a2b
7
+ data.tar.gz: 421e125545c088dec5c7b63f572180046422c87a60c6cabe0ac82dd9c81e19be0a888292c6857f1a25864dbc2f1ee115eff5696e716e39ef707ee157e82ec8d7
@@ -0,0 +1,41 @@
1
+ language: ruby
2
+ sudo: false
3
+ addons:
4
+ apt:
5
+ sources:
6
+ - chef-stable-precise
7
+ packages:
8
+ - chefdk
9
+ - wget
10
+ - unzip
11
+ - ssh
12
+
13
+ install:
14
+ - echo "skip bundle install"
15
+
16
+ before_script:
17
+ - ci/before-script.sh
18
+ # set chefdk as default environment
19
+ - eval "$(/opt/chefdk/bin/chef shell-init bash)"
20
+ # put terraform on PATH
21
+ - export PATH="$PWD/bin:$PATH"
22
+
23
+ script:
24
+ # run unit tests
25
+ - /opt/chefdk/embedded/bin/bundle install && /opt/chefdk/bin/chef exec rake
26
+ # setup acceptance tests
27
+ - cd acceptance && export BUNDLE_GEMFILE=$PWD/Gemfile && /opt/chefdk/embedded/bin/bundle install && export APPBUNDLER_ALLOW_RVM=true
28
+ # run acceptances tests and force cleanup
29
+ # only testing bourne until issues with powershell suite resovled:
30
+ # 1) inspec not finding chef package once connected (not reproducible locally)
31
+ # 2) currently no way to mask password (sensitive true) AND know what the error is if inspec fails
32
+ - /opt/chefdk/embedded/bin/bundle exec chef-acceptance test bourne --force-destroy
33
+
34
+ env:
35
+ global:
36
+ # access key id
37
+ - secure: "b/O77C/ebnrXw/xSTRMcAuhmUz9QH//jfh3XSQrZF2lRJZJbAbfL3L3SPLqQmPkMDJWCAJrs82umQJkZ0RJtSqX5ZzPUqdf2v5O4CyrfMqhQbsEA9GGUlBNaQmSWUHvOCPQZzI5GWMxgQb9Bhl4+ZekUoTgNZBjvh9uAHWuT1c1fNt5pHDYMXg4wyEnyF8tzLRVD5eTJwkKd+BodM1BUvdOITYv2xl6hlg7ZoJbo+onIVc8sRTnEjGiuprhaVyMSeTNSzxa/3jDxeX+HnJ/2HwpenIBXoSskZZViZHMd1Vy2sDUfYPfDjqwr389b8SInCehe1cCD8ouAr/7614IXxwoWSMjrVgkboB+KteRZyz0qVoqCpdS6NX0YBmu5I8T6jHr3OXVwVbcK03FrFhnS2Hg+oLhKLPKMvIFQ5347DEZ1LBv0ol//ltjk/cZX11yLiF2TrrDzSca3jb7kN/LJZ2AbGQdLJnqEhBm4NznHlPYfibLum0QwNXR/lZ47OJjBQnKc9nlN+iEOKbhby6/SCnW30xWJoMfNIULmW79heaNip16wDV0DBu44mmbKcFA6KMrNFex2+QpZGmNwbWJrwnvaJqVc6FNpRtNdShQ/81vJpn5Z6KKz676EHsM6LcXha1WnNj3eLYipWIg+4OSSmHJgRiuNC4JsgsYCaBfrDw8="
38
+ # secret access key
39
+ - secure: "Ut5ARdSnWiFVAtRZ7U+CPgihi59J/KgsMFXunJjBCYyfwaDxrIsAbjddhP3lu2d/xLtvQ26SodhnMh6VMfgBFljY1s4lgjlZU2xU5RCpXFsEhUzHjryVTEgEWYgWkGrTfvalB9gnrsRxiyOh6ZvlW7QoPED+j75FSGwj6rjGCYf/7oUa3Qlt2Pymma5ijjvemgcIEKngO7Dnh3dpFR/J4S0AZdZG6HtJvYpQ2gdvH5faFjYlKHp8W/PMuOuxq2w8Pcjw009VgOjLoFAFYhFWX3hGd0b+N1xBHJDlqaBk2UCCqaKtYrhAsgQNkFiPMmNdDUtscjKx81A8fBUJOUhUxWBFhL3QM2ymuZziPQcnikpi6EPRHRyv3P6MOSyEB2DPpzFq/tEniTBW6o9QL6dHYOaPm/CBtUJ36gEvrSEJQZyhxUTQdamjWIMOTcq1/uwjp0T28rdth0o4BoGALkNQxjaV9iPHBCNtZgPdLoG9v/5CyGwlRQaY6JSVxBHdRcD9+BfwLT84K+68NPo7xXBBar0B1kBOLExI3EHLTxaspkicM2DINicUZk+SNFdInuiByv9NT7sWWbISnk6EagxPxu8D2p1zcMh6cJ8DfFz0rws+ndGiPwInjoslSV7N8Ndi4j9nTKtv9qAImJlthzPDbHY8ghz0TrXWdtwzPet7j2s="
40
+ # windows admin password
41
+ # - secure: "lxe9NYpwV19g2mBa7aQoJX372hktSSn/g5oU1GDWYpi59YwpbYXP/Al/XXwq1ZfNzN+BlXw3tJPlVaEkfSQBi0AaWLJ6Kw5+a4tkIkwMyMPJQh+pKnADZK2pd+Hhrr7CRtnaT6w4V2sZCIfcdlLnKmez/BMNNdBn1+WAfE+aN224JK43rXxgLe4B9CcXCsUUORh6nJbB5f60D15qYokDu7ILi0RufyfyiJulqxIsXVNKtnUXOJRXZvDOPp9Y+2ur0HmVK7aiWr6JwXtODgrrDzZiWq99eR2ErDJB1AFUVMmudUykf5SWyivhvB4RStYDIIpG8EXrIhRKP+k9o4loqQBRcRBGvEMLdyupi7TzuryzK7j2XzhJFD9Eg+50Y5By87lRfvltuAJaDkRPfwIzSbWsh0Lb7YwUXI9a+bJebsteTPSFjb1YOYvkQCV2CB5pH68QInw8Hu9o2hmUkuoNWqqvVaxDI8z3peympfFlVtvTC9eOI60Tdv+pSCyQhBN0/II8FT/fylwQsOL+i8Hez9NIRdaRkx0JEpY56NloErd4An9zpY/xCAa/6JfzMWn7eD673MRVJW0u/j5IGuRAksuUlGZTQS+qudF4ZgVJaacm6qARULaesuCNbufZYtRB0Hg+GINQrUSfYKBw6BZUk2T9ZQ2zFsnF12k0yl9Qr7I="
@@ -1,7 +1,11 @@
1
1
  # Change Log
2
2
 
3
- ## [1.2.4]
4
- - Major version 1 deprecated. Update to major version 2.
3
+ ## [2.0.0]
4
+ - Replaced all backends with PackageRouter
5
+ - All channels are now available using the single backend
6
+ - Enabled unstable channel for install.sh and install.ps1 scripts
7
+ - Added chef-acceptance test suites and configured them to run in Travis
8
+ - Relaxed several test dependency versions
5
9
 
6
10
  ## [1.2.3]
7
11
  - Add inspec as a supported product
data/README.md CHANGED
@@ -14,10 +14,10 @@ options = {
14
14
  }
15
15
 
16
16
  artifact = Mixlib::Install.new(options).artifact_info
17
- # => ArtifactInfo
17
+ # => #<Mixlib::Install::ArtifactInfo>
18
18
 
19
19
  artifact.url
20
- # => "http://opscode-omnibus-packages-current.s3.amazonaws.com/mac_os_x/10.9/x86_64/chef-12.5.1%2B20151009083009-1.dmg"
20
+ # => "https://packages.chef.io/files/current/chef/12.14.90/mac_os_x/10.9/chef-12.14.90-1.dmg"
21
21
  ```
22
22
 
23
23
  ### Get list of artifacts for all platforms given a package version
@@ -29,10 +29,10 @@ options = {
29
29
  }
30
30
 
31
31
  artifacts = Mixlib::Install.new(options).artifact_info
32
- # => Array<ArtifactInfo>
32
+ # => [#<Mixlib::Install::ArtifactInfo>, ...]
33
33
 
34
34
  artifacts.first.url
35
- # => "http://opscode-omnibus-packages-current.s3.amazonaws.com/mac_os_x/10.9/x86_64/chef-12.5.1%2B20151009083009-1.dmg"
35
+ # => => "https://packages.chef.io/files/current/chef/12.14.90/mac_os_x/10.11/chef-12.14.90-1.dmg"
36
36
  ```
37
37
 
38
38
  ### Detect platform information
@@ -80,18 +80,7 @@ Mixlib::Install.new(options).available_versions
80
80
  # => ["12.13.3", "12.13.7", "12.13.8+20160721014124", "12.13.11+20160721165202"]
81
81
  ```
82
82
 
83
- ## Unstable channel
84
- The `:unstable` channel is currently only available when connected to Chef's internal network.
85
-
86
- ## Feature Flags
87
-
88
- Below are the environment variables you can set to tune certain aspects of mixlib-install. They enable some features that are currently under development. You should use these features with care.
89
-
90
- `MIXLIB_INSTALL_UNIFIED_BACKEND` => Enables unified backend feature which uses Artifactory backend for all available channels.
91
-
92
83
  ## Development
93
- Since mixlib-install needs to interact with Bintray and Artifactory and since Artifactory instances are only available in Chef's network, this project uses [vcr](https://github.com/vcr/vcr).
94
-
95
84
  VCR is a tool that helps cache and replay http responses. When these responses change or when you add more tests you might need to update cached responses. Check out [spec_helper.rb](https://github.com/chef/mixlib-install/blob/master/spec/spec_helper.rb) for instructions on how to do this.
96
85
 
97
86
  ## Contributing
data/Rakefile CHANGED
@@ -18,21 +18,11 @@ rescue LoadError
18
18
  puts "chefstyle/rubocop is not available. gem install chefstyle to do style checking."
19
19
  end
20
20
 
21
- desc "Run specs for unified_backend (artifactory)"
22
- task :unified_backend do
23
- ENV["MIXLIB_INSTALL_UNIFIED_BACKEND"] = "true"
24
- ENV["ARTIFACTORY_ENDPOINT"] = "https://packages-acceptance.chef.io"
25
- Rake::Task["spec"].reenable
26
- Rake::Task["spec"].invoke
27
- ENV.delete "MIXLIB_INSTALL_UNIFIED_BACKEND"
28
- ENV.delete "ARTIFACTORY_ENDPOINT"
29
- end
30
-
31
21
  desc "Run all tests"
32
- task test: [:style, :spec, :unified_backend]
22
+ task test: [:style, :spec]
33
23
 
34
24
  desc "Run tests for Travis CI"
35
- task ci: [:style, :spec, :unified_backend]
25
+ task ci: [:style, :spec]
36
26
 
37
27
  desc "Render product matrix documentation"
38
28
  task "matrix" do
@@ -1,2 +1,8 @@
1
1
  /Gemfile.lock
2
- /.acceptance_logs/
2
+ /.acceptance_data/
3
+
4
+ # Terraform
5
+ *.tfstate
6
+ *.tfstate.backup
7
+ *_override.tf
8
+
@@ -1,12 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "mixlib-install", path: "../"
4
- gem "test-kitchen", github: "sersut/test-kitchen", branch: "sersut/mixlib-install-update"
5
4
  gem "chef-acceptance", github: "chef/chef-acceptance"
6
- gem "pry"
7
-
8
- group(:development) do
9
- gem "kitchen-vagrant"
10
- gem "windows_chef_zero"
11
- gem "winrm-transport"
12
- end
@@ -0,0 +1,6 @@
1
+ Using rvm? Run this: `export APPBUNDLER_ALLOW_RVM=true`
2
+
3
+ Install deps `bundle install`
4
+
5
+ Then run `bundle exec chef-acceptance test`
6
+
@@ -0,0 +1,8 @@
1
+ nodes/
2
+ tmp/
3
+
4
+ # Terraform
5
+ *.tfstate
6
+ *.tfstate.backup
7
+ *_override.tf
8
+
@@ -0,0 +1,3 @@
1
+ execute "terraform destroy -force" do
2
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
3
+ end
@@ -0,0 +1,11 @@
1
+ execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.install_sh\" > ../.acceptance_data/install.sh" do
2
+ cwd node['chef-acceptance']['suite-dir']
3
+ end
4
+
5
+ execute "terraform plan" do
6
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
7
+ end
8
+
9
+ execute "terraform apply" do
10
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
11
+ end
@@ -0,0 +1,11 @@
1
+ ruby_block "get ip" do
2
+ block do
3
+ tf_state = JSON.parse(File.read("#{node['chef-acceptance']['suite-dir']}/terraform/terraform.tfstate"))
4
+ node.default["ip"] = tf_state["modules"].first["resources"]["aws_instance.mixlib_install_sh"]["primary"]["attributes"]["public_ip"]
5
+ end
6
+ end
7
+
8
+ execute "run inspec" do
9
+ command lazy { "inspec exec verify.rb -t ssh://ubuntu@#{node['ip']} -i ~/.ssh/es-infrastructure.pem" }
10
+ cwd "#{node['chef-acceptance']['suite-dir']}/inspec"
11
+ end
@@ -0,0 +1,3 @@
1
+ describe package("chef") do
2
+ it { should be_installed }
3
+ end
@@ -0,0 +1,78 @@
1
+ data "aws_ami" "ubuntu_14_ami" {
2
+ most_recent = true
3
+
4
+ filter {
5
+ name = "owner-id"
6
+ values = ["099720109477"]
7
+ }
8
+
9
+ filter {
10
+ name = "name"
11
+ values = ["ubuntu/images/*/ubuntu-*-14.04-*-server-*"]
12
+ }
13
+
14
+ filter {
15
+ name = "architecture"
16
+ values = ["x86_64"]
17
+ }
18
+
19
+ filter {
20
+ name = "virtualization-type"
21
+ values = ["hvm"]
22
+ }
23
+
24
+ filter {
25
+ name = "block-device-mapping.volume-type"
26
+ values = ["gp2"]
27
+ }
28
+
29
+ filter {
30
+ name = "image-type"
31
+ values = ["machine"]
32
+ }
33
+ }
34
+
35
+ resource "aws_instance" "mixlib_install_sh" {
36
+ count = 1
37
+
38
+ ami = "${data.aws_ami.ubuntu_14_ami.id}"
39
+ instance_type = "${var.aws_instance_type}"
40
+ key_name = "es-infrastructure"
41
+
42
+ associate_public_ip_address = true
43
+
44
+ subnet_id = "subnet-11ac0174" # Planet Releng Public Subnet
45
+ source_dest_check = false
46
+
47
+ vpc_security_group_ids = [
48
+ "sg-96274af3",
49
+ ]
50
+
51
+ connection {
52
+ user = "ubuntu"
53
+ private_key = "${file("${var.connection_private_key}")}"
54
+ agent = "${var.connection_agent}"
55
+ timeout = "10m"
56
+ }
57
+
58
+ tags {
59
+ # ChefOps's AWS standard tags:
60
+ X-Dept = "EngServ"
61
+ X-Contact = "pwright"
62
+ X-Production = "false"
63
+ X-Environment = "development"
64
+ X-Application = "mixlib-install"
65
+ }
66
+
67
+ provisioner "file" {
68
+ source = "../../.acceptance_data/install.sh"
69
+ destination = "/tmp/install.sh"
70
+ }
71
+
72
+ provisioner "remote-exec" {
73
+ inline = [
74
+ "chmod +x /tmp/install.sh",
75
+ "sudo bash /tmp/install.sh",
76
+ ]
77
+ }
78
+ }
@@ -0,0 +1,8 @@
1
+ # Restrict operation of terraform to chef-es profile so that
2
+ # we do not create resources in other aws profiles.
3
+ # We assume user has configured standard aws credentials
4
+ # under ~/.aws/credentials or with $AWS_SHARED_CREDENTIALS_FILE
5
+ provider "aws" {
6
+ region = "${var.aws_region}"
7
+ profile = "chef-aws"
8
+ }
@@ -0,0 +1,27 @@
1
+ # Region to create infrastructure in
2
+ variable "aws_region" {
3
+ type = "string"
4
+ default = "us-west-2"
5
+ }
6
+
7
+ variable "aws_instance_type" {
8
+ type = "string"
9
+ default = "t2.micro"
10
+ }
11
+
12
+ # Used to indicidate whether the environment should be treated as "prod"
13
+ # This is mainly used for the `X-Production` AWS tag.
14
+ variable "production" {
15
+ default = "false"
16
+ }
17
+
18
+ # SSH Connection info used for remote provisioning instances
19
+ variable "connection_agent" {
20
+ description = "Set to false to disable using ssh-agent to authenticate"
21
+ default = false
22
+ }
23
+
24
+ variable "connection_private_key" {
25
+ description = "File path to AWS keypair private key to provision with"
26
+ default = "~/.ssh/es-infrastructure.pem"
27
+ }
@@ -0,0 +1,3 @@
1
+ execute "terraform destroy -force" do
2
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
3
+ end
@@ -0,0 +1,12 @@
1
+ execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.install_ps1, 'install'\" > ../.acceptance_data/install.ps1" do
2
+ cwd node['chef-acceptance']['suite-dir']
3
+ end
4
+
5
+ execute "terraform plan" do
6
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
7
+ end
8
+
9
+ execute "terraform apply" do
10
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
11
+ end
12
+
@@ -0,0 +1,12 @@
1
+ ruby_block "get ip" do
2
+ block do
3
+ tf_state = JSON.parse(File.read("#{node['chef-acceptance']['suite-dir']}/terraform/terraform.tfstate"))
4
+ node.default["ip"] = tf_state["modules"].first["resources"]["aws_instance.mixlib_install_ps1"]["primary"]["attributes"]["public_ip"]
5
+ end
6
+ end
7
+
8
+ execute "run inspec" do
9
+ command lazy { "inspec exec verify.rb -t winrm://Administrator@#{node['ip']} --password '#{ENV['TF_VAR_admin_password'] || 'Pas5w0rD'}'" }
10
+ cwd "#{node['chef-acceptance']['suite-dir']}/inspec"
11
+ # sensitive true
12
+ end
@@ -0,0 +1,3 @@
1
+ describe package("chef") do
2
+ it { should be_installed }
3
+ end
@@ -0,0 +1,89 @@
1
+ data "aws_ami" "windows_ami" {
2
+ most_recent = true
3
+
4
+ filter {
5
+ name = "owner-alias"
6
+ values = ["amazon"]
7
+ }
8
+
9
+ filter {
10
+ name = "name"
11
+ values = ["Windows_Server-2012-R2*-English-*-Base-*"]
12
+ }
13
+
14
+ filter {
15
+ name = "architecture"
16
+ values = ["x86_64"]
17
+ }
18
+
19
+ filter {
20
+ name = "virtualization-type"
21
+ values = ["hvm"]
22
+ }
23
+
24
+ filter {
25
+ name = "block-device-mapping.volume-type"
26
+ values = ["gp2"]
27
+ }
28
+
29
+ filter {
30
+ name = "image-type"
31
+ values = ["machine"]
32
+ }
33
+ }
34
+
35
+ resource "aws_instance" "mixlib_install_ps1" {
36
+ count = 1
37
+
38
+ ami = "${data.aws_ami.windows_ami.id}"
39
+ instance_type = "${var.aws_instance_type}"
40
+ key_name = "es-infrastructure"
41
+
42
+ associate_public_ip_address = true
43
+
44
+ subnet_id = "subnet-11ac0174" # Planet Releng Public Subnet
45
+ source_dest_check = false
46
+
47
+ vpc_security_group_ids = [
48
+ "sg-96274af3",
49
+ ]
50
+
51
+ connection {
52
+ type = "winrm"
53
+ user = "Administrator"
54
+ password = "${var.admin_password}"
55
+ timeout = "10m"
56
+ }
57
+
58
+ user_data = <<EOF
59
+ <script>
60
+ winrm quickconfig -q & winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"} & winrm set winrm/config @{MaxTimeoutms="1800000"} & winrm set winrm/config/service @{AllowUnencrypted="true"} & winrm set winrm/config/service/auth @{Basic="true"}
61
+ </script>
62
+ <powershell>
63
+ Set-ExecutionPolicy -ExecutionPolicy Bypass
64
+ netsh advfirewall firewall add rule name="WinRM in" protocol=TCP dir=in profile=any localport=5985 remoteip=any localip=any action=allow
65
+ $admin = [adsi]("WinNT://./administrator, user")
66
+ $admin.psbase.invoke("SetPassword", "${var.admin_password}")
67
+ </powershell>
68
+ EOF
69
+
70
+ tags {
71
+ # ChefOps's AWS standard tags:
72
+ X-Dept = "EngServ"
73
+ X-Contact = "pwright"
74
+ X-Production = "false"
75
+ X-Environment = "development"
76
+ X-Application = "mixlib-install"
77
+ }
78
+
79
+ provisioner "file" {
80
+ source = "../../.acceptance_data/install.ps1"
81
+ destination = "/tmp/install.ps1"
82
+ }
83
+
84
+ provisioner "remote-exec" {
85
+ inline = [
86
+ "powershell.exe -file /tmp/install.ps1",
87
+ ]
88
+ }
89
+ }