Skip to content

Instantly share code, notes, and snippets.

@rackerbenoit
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rackerbenoit/234fe13a7cc9c428788f to your computer and use it in GitHub Desktop.
Save rackerbenoit/234fe13a7cc9c428788f to your computer and use it in GitHub Desktop.
I added this:
export ATLAS_TOKEN=FF
{
"variables": {
"aws_access_key": "FF",
"aws_secret_key": "FF"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami": "ami-9a562df2",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "consul {{timestamp}}"
}],
"push": {
"name": "maniac36/consul",
"vcs": false
},
"provisioners": [
{
"type": "shell",
"inline": [
"sudo mkdir /ops",
"sudo chmod a+w /ops"
]
},
{
"type": "file",
"source": ".",
"destination": "/ops"
},
{
"type": "shell",
"script": "scripts/base.sh"
},
{
"type": "shell",
"script": "scripts/consul.sh"
}
],
"post-processors": [
{
"type": "atlas",
"artifact": "maniac36/consul",
"artifact_type": "aws.ami",
"metadata": {
"created_at": "{{timestamp}}"
}
}
]
}
provider "aws" {
access_key = "FF"
secret_key = "FF"
region = "us-east-1"
}
resource "atlas_artifact" "consul" {
name = "maniac36/consul"
type = "aws.ami"
}
//resource "aws_instance" "consul" {
// instance_type = "t2.micro"
// ami = "${atlas_artifact.consul.metadata_full.region-us-east-1}"
// # This will create 3 instances
// count = 3
//}
description "Consul"
start on vagrant-ready or runlevel [2345]
stop on runlevel [!2345]
respawn
console log
script
if [ -f "/etc/service/consul" ]; then
. /etc/service/consul
fi
# Make sure to use all our CPUs, because Consul can block a scheduler thread
export GOMAXPROCS=`nproc`
exec /usr/bin/consul agent \
-server \
-data-dir="/tmp/consul" \
-atlas=maniac36/infrastructure \
-atlas-join \
-atlas-token="FFreBSRx8iS3FcamazokCW17m4s-Lv4Bs_KS4nxj7SH7PxVPd1fLRcLDpeCoRUYMo2k" \
-bootstrap-expect 3 \
-config-dir="/etc/consul.d" \
${CONSUL_FLAGS} \
>>/var/log/consul.log 2>&1
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment