-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1838 from chef/csnapp/add_standalone_fresh
Add standalone fresh install terraform scenario
- Loading branch information
Showing
11 changed files
with
194 additions
and
40 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
terraform/aws/scenarios/omnibus-external-openldap/files/dhparam.pem
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
terraform/aws/scenarios/omnibus-standalone-fresh-install/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Omnibus Standalone Fresh Install | ||
|
||
This directory contains the Terraform code used to instantiate a single Chef Infra Server utilizing an Omnibus built artifact downloaded from `$upgrade_version_url` as the install package. | ||
|
||
Once the server has been installed and configured, the pedant tests are run against the server. |
11 changes: 11 additions & 0 deletions
11
terraform/aws/scenarios/omnibus-standalone-fresh-install/files/chef-server.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
opscode_erchef['keygen_start_size'] = 30 | ||
|
||
opscode_erchef['keygen_cache_size']=60 | ||
|
||
nginx['ssl_dhparam']='/etc/opscode/dhparam.pem' | ||
|
||
insecure_addon_compat false | ||
|
||
data_collector['token'] = 'foobar' | ||
|
||
profiles['root_url'] = 'http://localhost:9998' |
99 changes: 99 additions & 0 deletions
99
terraform/aws/scenarios/omnibus-standalone-fresh-install/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
module "chef_server" { | ||
source = "../../modules/aws_instance" | ||
|
||
aws_profile = "${var.aws_profile}" | ||
aws_region = "${var.aws_region}" | ||
aws_vpc_name = "${var.aws_vpc_name}" | ||
aws_department = "${var.aws_department}" | ||
aws_contact = "${var.aws_contact}" | ||
aws_ssh_key_id = "${var.aws_ssh_key_id}" | ||
aws_instance_type = "${var.aws_instance_type}" | ||
enable_ipv6 = "${var.enable_ipv6}" | ||
platform = "${var.platform}" | ||
name = "${var.scenario}-${var.enable_ipv6 ? "ipv6" : "ipv4"}-${var.platform}" | ||
} | ||
|
||
resource "null_resource" "chef_server_config" { | ||
connection { | ||
type = "ssh" | ||
user = "${module.chef_server.ssh_username}" | ||
host = "${module.chef_server.public_ipv4_dns}" | ||
} | ||
|
||
provisioner "file" { | ||
source = "${path.module}/files/chef-server.rb" | ||
destination = "/tmp/chef-server.rb" | ||
} | ||
|
||
provisioner "file" { | ||
source = "${path.module}/../../../common/files/dhparam.pem" | ||
destination = "/tmp/dhparam.pem" | ||
} | ||
|
||
# install chef-server | ||
provisioner "remote-exec" { | ||
inline = [ | ||
"set -evx", | ||
"echo -e '\nBEGIN INSTALL CHEF SERVER\n'", | ||
"curl -vo /tmp/${replace(var.upgrade_version_url, "/^.*\\//", "")} ${var.upgrade_version_url}", | ||
"sudo ${replace(var.upgrade_version_url, "rpm", "") != var.upgrade_version_url ? "rpm -U" : "dpkg -iEG"} /tmp/${replace(var.upgrade_version_url, "/^.*\\//", "")}", | ||
"sudo chown root:root /tmp/chef-server.rb", | ||
"sudo chown root:root /tmp/dhparam.pem", | ||
"sudo mv /tmp/chef-server.rb /etc/opscode", | ||
"sudo mv /tmp/dhparam.pem /etc/opscode", | ||
"sudo chef-server-ctl reconfigure --chef-license=accept", | ||
"sleep 120", | ||
"echo -e '\nEND INSTALL CHEF SERVER\n'", | ||
] | ||
} | ||
|
||
# add user + organization | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/add_user.sh" | ||
} | ||
} | ||
|
||
resource "null_resource" "chef_server_test" { | ||
depends_on = ["null_resource.chef_server_config"] | ||
|
||
connection { | ||
type = "ssh" | ||
user = "${module.chef_server.ssh_username}" | ||
host = "${module.chef_server.public_ipv4_dns}" | ||
} | ||
|
||
# run smoke test | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/test_chef_server-smoke.sh" | ||
} | ||
|
||
# install push jobs addon | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/install_addon_push_jobs.sh" | ||
} | ||
|
||
# test push jobs addon | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/test_addon_push_jobs.sh" | ||
} | ||
|
||
# install chef manage addon | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/install_addon_chef_manage.sh" | ||
} | ||
|
||
# run pedant test | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/test_chef_server-pedant.sh" | ||
} | ||
|
||
# run psql test | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/test_psql.sh" | ||
} | ||
|
||
# run gather-logs test | ||
provisioner "remote-exec" { | ||
script = "${path.module}/../../../common/files/test_gather_logs.sh" | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
terraform/aws/scenarios/omnibus-standalone-fresh-install/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
######################################################################### | ||
# AWS | ||
######################################################################### | ||
variable "aws_profile" { | ||
type = "string" | ||
description = "Name of the AWS profile used for authentication (e.g. chef-engineering)." | ||
default = "chef-engineering" | ||
} | ||
|
||
variable "aws_region" { | ||
type = "string" | ||
description = "Name of the AWS region to create instances in (e.g. us-west-2)." | ||
default = "us-west-1" | ||
} | ||
|
||
variable "aws_vpc_name" { | ||
type = "string" | ||
description = "Name of the AWS virtual private cloud where tests will be run." | ||
default = "" | ||
} | ||
|
||
variable "aws_department" { | ||
type = "string" | ||
description = "Department that owns the resources should be one of: EngServ, Operations, Eng, Training, Solutions, Sales, BD, Success or Partner" | ||
} | ||
|
||
variable "aws_contact" { | ||
type = "string" | ||
description = "The primary contact for the resources, this should be the IAM username and must be able to receive email by appending @chef.io to it (this person can explain what/why, might not be the business owner)." | ||
} | ||
|
||
variable "aws_ssh_key_id" { | ||
type = "string" | ||
description = "AWS ID of the SSH key used to access the instance (e.g. csnapp)." | ||
} | ||
|
||
variable "aws_instance_type" { | ||
type = "string" | ||
description = "Name of the AWS instance type used to determine size of instances (e.g. t2.medium)." | ||
default = "t2.medium" | ||
} | ||
|
||
variable "platform" { | ||
type = "string" | ||
description = "Operating System of the instance to be created." | ||
} | ||
|
||
######################################################################### | ||
# Chef Server | ||
######################################################################### | ||
variable "scenario" { | ||
type = "string" | ||
description = "The name of the scenario being executed." | ||
} | ||
|
||
variable "install_version_url" { | ||
type = "string" | ||
description = "The URL to a chef-server used during initial install." | ||
} | ||
|
||
variable "upgrade_version_url" { | ||
type = "string" | ||
description = "The URL to a chef-server artifact used during upgrades." | ||
} | ||
|
||
variable "enable_ipv6" { | ||
type = "string" | ||
description = "Use IPv6 in the chef-server.rb config and /etc/hosts." | ||
} |
8 changes: 0 additions & 8 deletions
8
terraform/aws/scenarios/omnibus-standalone-upgrade/files/dhparam.pem
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
terraform/aws/scenarios/omnibus-tiered-fresh-install/files/dhparam.pem
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
terraform/aws/scenarios/omnibus-tiered-upgrade/files/dhparam.pem
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
terraform/azure/scenarios/omnibus-external-postgres/files/dhparam.pem
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters