Skip to content

Cookbooks and Packer for generating a Habitat Workstation for use in training workshops.

License

Notifications You must be signed in to change notification settings

chef-cft/habitat_workstation

Repository files navigation

Habitat Workstation

Cookbooks and Packer config to create a workstation for use during Habitat workshops.

Current Amazon Machine Image IDs

Looking for Windows worksations? Checkout the Windows Habitat Workstation repo.

AMIs can be built in any region as long as you have your keypair setup in that region.

Before you begin export AWS_REGION to the region you want to build in:

$ export AWS_REGION=us-east-1

Alternatively an ~/.aws/config file might look like:

[default]
region=us-east-1
aws_access_key_id = MYKEYID
aws_secret_access_key = MYACCESSKEY
Platform AMI ID Hab Version Region
CentOS 7 ami-0ea7e58bedf969904 none us-west-2
Ubuntu 16.04 ami-0f4fd8a06b04a50a7 none us-west-2
CentOS 7 ami-01330a64affb4a3d2 0.79.1 us-west-2
Ubuntu 16.04 ami-0464aa40892739fa7 0.79.1 us-west-2
CentOS 7 ami-0ad970b2f97c0180b 0.79.1 us-east-1
Ubuntu 16.04 ami-075b87293eddaa4d1 0.79.1 us-east-1

Pre-requisites

# The name of the AWS KeyPair to use for deployment
export $AWS_KEYPAIR_NAME='your_aws_keypair_name'

Build the Amazon Machine Images (AMIs)

This rake task updates the vendored cookbooks before building the AMIs.

$ rake cookbook:vendor

To create AMIs with Habitat installed

$ rake "ami:build[ubuntu-1604,0.24.1]"

The latest version of Habitat will be installed, The version is for display purposes unless set to none

To create AMIs without Habitat installed

$ rake "ami:build[centos-7,none]"

List available templates

$ rake list:templates
centos-7
ubuntu-1604

Share the AMIs with other Amazon accounts

$ export AMI_ID=the_ami_id_generated_by_packer
$ rake ami:share

Deploy with Terraform

This deploys one or more workstations to AWS based off of variables set in a terraform.tfvars file.

$ cd terraform/aws
$ cp tfvars.example terraform.tfvars

EDIT: terraform.tfvars with values for your environment

$ terraform init
$ terraform apply

After the terraform apply completes you will get an output of IP addresses to connect to. When you are finished with your workshop you can simply run terraform destroy from the terraform/aws directory.

Deploy the CloudFormation stack

This deploys a CloudFormation stack with the number of hosts and TTL (days). A template will be created in stacks/ with the arguments above using values from config.yml. An example, config.example.yml, is included

# rake deploy[name,num_hosts,ttl]

$ export AMI_ID=the AMI_ID #(generated by the rake task "ami:build above)
$ rake "deploy[habihacks-stack,10,3]"
$ cat config.example.yml
---
contact: Human Chef
dept: Community Engineering
project: Habihacks
region: us-east-1
sg: sg-a1c3b1db
subnet: subnet-46b55431
type: t2.medium

List Workstation IPs for a CloudFormation stack

$ rake "list:ips[habihacks-stack]"
workstation1: 54.172.141.159
workstation2: 54.87.195.76
workstation3: 54.91.122.177
workstation4: 54.86.46.187
workstation5: 54.227.190.60

License

Copyright: 2017-2018, Chef Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Cookbooks and Packer for generating a Habitat Workstation for use in training workshops.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •