demo/digitalocean: add statsite for servers

This commit is contained in:
Ryan Uber 2015-09-24 12:26:17 -07:00
parent 50371077aa
commit bfc678c534
3 changed files with 37 additions and 0 deletions

View File

@ -6,11 +6,18 @@ resource "atlas_artifact" "nomad-digitalocean" {
version = "latest"
}
module "statsite" {
source = "./statsite"
region = "nyc3"
ssh_keys = "${var.ssh_keys}"
}
module "servers" {
source = "./server"
region = "nyc3"
image = "${atlas_artifact.nomad-digitalocean.id}"
ssh_keys = "${var.ssh_keys}"
statsite = "${module.statsite.addr}"
}
module "clients-nyc3" {

View File

@ -2,6 +2,7 @@ variable "image" {}
variable "region" {}
variable "size" { default = "1gb" }
variable "ssh_keys" {}
variable "statsite" {}
resource "digitalocean_droplet" "server" {
image = "${var.image}"
@ -23,6 +24,9 @@ advertise {
rpc = "${self.ipv4_address}:4647"
serf = "${self.ipv4_address}:4648"
}
telemetry {
statsite_address = "${var.statsite}"
}
EOF
CMD
}

View File

@ -0,0 +1,26 @@
variable "size" { default = "1gb" }
variable "region" {}
variable "ssh_keys" {}
resource "atlas_artifact" "statsite-digitalocean" {
name = "hashicorp/nomad-demo-statsite"
type = "digitalocean.image"
version = "latest"
}
resource "digitalocean_droplet" "statsite" {
image = "${atlas_artifact.statsite-digitalocean.id}"
name = "statsite-${var.region}-${count.index}"
count = 1
size = "${var.size}"
region = "${var.region}"
ssh_keys = ["${split(",", var.ssh_keys)}"]
provisioner "remote-exec" {
inline = "sudo start statsite || true"
}
}
output "addr" {
value = "${digitalocean_droplet.statsite.ipv4_address}:8125"
}