Skip to content

a development server built with packer, ansible and terraform, validated with goss

Notifications You must be signed in to change notification settings

benmangold/dev-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dev-server

ephemeral ubuntu development environment in an ami

deployed in an aws autoscaling group configured in terraform

built with packer, ansible and terraform

dev-server-role

postgresql, docker, nodejs 12, oh-my-zsh, ready out of the box

configured via benmangold/dev-server-role and Ansible Galaxy

build scripts

requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to be available in environment

packer

validate packer json, and then build a new ami with packer (packer calls ansible)

make packer

is the same as:

make validate
make build

terraform

initialize terraform, deploy ami configured in terraform/main.tf, and connect with ssh. then, destroy the infrastructure

make init
make apply
make connect
make destroy

goss

server validation is run by Packer with Goss. Goss validation configs are in goss.yml.

First, Goss is installed via Ansible with benmangold/install-goss-role in ubuntu/ansible/playbook.yml:

    ...
    - name: Goss Install
      import_role:
        name: install-goss-role
    ...

then, goss/goss.yml is copied and validated via Packer provisioners in ubuntu/ubuntu-ami.json:

    ...
      {
        "type": "file",
        "source": "goss/goss.yml",
        "destination": "/tmp/goss.yml"
      },
      {
        "type": "shell",
        "inline":[
            "goss --gossfile=/tmp/goss.yml validate"
        ]
      },
    ...

terraform

this repo includes configs to deploy the ami to an ec2 in an autoscaling group

note the configs are currently not secure for production use, but allow for http requests to the asg and ssh access to servers

initial terraform configs are ripped out of benmangold/tf-up-and-running

do not leave this server running until security has been improved

commands

packer commands

make validate - validate packer json

make build - build ami via packer:

terraform commands

make init - initialize terraform

make deploy - deploys ami via terraform apply

make destroy - destroys current infrastructure

misc commands

make connect - connects to a running, tagged ec2 via ssh

ci

a new ami will build with commits to main

misc ssh notes

wsl setup

exec ssh-agent zsh # start ssh-agent if not started
ssh-add # add local ssh keys key
ssh-add ~/.ssh/my-ssh-key.pem # add ec2-auth key

be sure to forward your local ssh keys with -A

special thanks

to artis3n/cloud-hackbox for inspiration and reference