Skip to content

Instantly share code, notes, and snippets.

@lgfa29
Created September 2, 2021 18:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgfa29/7e86aecb16698c0e006ee0646b9e2ae3 to your computer and use it in GitHub Desktop.
Save lgfa29/7e86aecb16698c0e006ee0646b9e2ae3 to your computer and use it in GitHub Desktop.
job "nomad" {
datacenters = ["dc1"]
group "region-1" {
task "server-1" {
driver = "raw_exec"
config {
command = "local/bin/nomad"
args = ["agent", "-config", "local/conf/config.hcl"]
}
artifact {
source = "https://releases.hashicorp.com/nomad/1.1.4/nomad_1.1.4_darwin_amd64.zip"
destination = "local/bin"
}
template {
data = <<EOF
data_dir = "{{ env "NOMAD_TASK_DIR" }}"
log_level = "DEBUG"
name = "server-1"
region = "region-1"
server {
enabled = true
bootstrap_expect = 1
}
ports {
http = "5646"
rpc = "5647"
serf = "5648"
}
EOF
destination = "local/conf/config.hcl"
}
}
task "client-1" {
driver = "raw_exec"
config {
command = "local/bin/nomad"
args = ["agent", "-config", "local/conf/config.hcl"]
}
artifact {
source = "https://releases.hashicorp.com/nomad/1.1.4/nomad_1.1.4_darwin_amd64.zip"
destination = "local/bin"
}
template {
data = <<EOF
data_dir = "{{ env "NOMAD_TASK_DIR" }}"
log_level = "DEBUG"
name = "client-1"
region = "region-1"
client {
enabled = true
servers = ["{{ env "attr.unique.network.ip-address" }}:5647"]
}
ports {
http = "5656"
rpc = "5657"
serf = "5658"
}
EOF
destination = "local/conf/config.hcl"
}
}
}
group "region-2" {
task "server-1" {
driver = "raw_exec"
config {
command = "local/bin/nomad"
args = ["agent", "-config", "local/conf/config.hcl"]
}
artifact {
source = "https://releases.hashicorp.com/nomad/1.1.4/nomad_1.1.4_darwin_amd64.zip"
destination = "local/bin"
}
template {
data = <<EOF
data_dir = "{{ env "NOMAD_TASK_DIR" }}"
log_level = "DEBUG"
name = "server-1"
region = "region-2"
server {
enabled = true
bootstrap_expect = 1
}
ports {
http = "6646"
rpc = "6647"
serf = "6648"
}
EOF
destination = "local/conf/config.hcl"
}
}
task "client-1" {
driver = "raw_exec"
config {
command = "local/bin/nomad"
args = ["agent", "-config", "local/conf/config.hcl"]
}
artifact {
source = "https://releases.hashicorp.com/nomad/1.1.4/nomad_1.1.4_darwin_amd64.zip"
destination = "local/bin"
}
template {
data = <<EOF
data_dir = "{{ env "NOMAD_TASK_DIR" }}"
log_level = "DEBUG"
name = "client-1"
region = "region-2"
client {
enabled = true
servers = ["{{ env "attr.unique.network.ip-address" }}:6647"]
}
ports {
http = "6656"
rpc = "6657"
serf = "6658"
}
EOF
destination = "local/conf/config.hcl"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment