1job "client" {
2  datacenters = ["dc1"]
3
4  group "client" {
5    count = 6
6
7    task "agent" {
8      driver = "docker"
9
10      config {
11        image = "djenriquez/nomad:v0.6.0"
12
13        # command = "nomad"
14        args         = ["agent"]
15        network_mode = "host"
16        volumes      = ["local/config:/etc/nomad", "/var/run/docker.sock:/var/run/docker.sock", "/tmp:/tmp"]
17        privileged   = true
18      }
19
20      resources {
21        cpu    = 300
22        memory = 100
23
24        network {
25          mbits = 10
26          port  "http"{}
27        }
28      }
29
30      template {
31        data = <<EOF
32log_level    = "DEBUG"
33data_dir     = "/tmp/nomad-client{{ env "NOMAD_ALLOC_INDEX" }}"
34name         = "client-{{ env "NOMAD_ALLOC_INDEX" }}"
35enable_debug = true
36client {
37  enabled = true
38  servers = ["127.0.0.1:4647"]
39  options {
40    "driver.raw_exec.enable" = "1"
41  }
42}
43
44ports {
45  http = {{ env "NOMAD_PORT_http" }}
46}
47	 EOF
48
49        destination = "local/config/client.hcl"
50      }
51    }
52  }
53}
54