Skip to content

Commit

Permalink
Merge pull request #1838 from chef/csnapp/add_standalone_fresh
Browse files Browse the repository at this point in the history
Add standalone fresh install terraform scenario
  • Loading branch information
PrajaktaPurohit authored Nov 21, 2019
2 parents f79523c + d0f551c commit 5a86e33
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 40 deletions.

This file was deleted.

5 changes: 5 additions & 0 deletions terraform/aws/scenarios/omnibus-external-openldap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ resource "null_resource" "chef_server_config" {
"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" {
Expand Down
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.
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 terraform/aws/scenarios/omnibus-standalone-fresh-install/main.tf
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"
}
}
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."
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 5 additions & 0 deletions terraform/azure/scenarios/omnibus-external-postgres/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ resource "null_resource" "chef_server_config" {
"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" {
Expand Down

0 comments on commit 5a86e33

Please sign in to comment.