github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/consultemplate/input/template_shared_alloc.nomad (about)

     1  job "template-shared-alloc" {
     2    datacenters = ["dc1", "dc2"]
     3  
     4    constraint {
     5      attribute = "${attr.kernel.name}"
     6      value     = "linux"
     7    }
     8  
     9    group "template-paths" {
    10  
    11      task "raw_exec" {
    12        driver = "raw_exec"
    13        config {
    14          command = "/bin/sh"
    15          args    = ["-c", "sleep 300"]
    16        }
    17  
    18        lifecycle {
    19          hook    = "prestart"
    20          sidecar = true
    21        }
    22  
    23        artifact {
    24          source      = "https://google.com"
    25          destination = "../alloc/google1.html"
    26        }
    27  
    28        template {
    29          destination = "${NOMAD_ALLOC_DIR}/${NOMAD_TASK_NAME}.env"
    30          data        = <<EOH
    31  {{env "NOMAD_ALLOC_DIR"}}
    32  EOH
    33        }
    34  
    35        template {
    36          destination = "${NOMAD_ALLOC_DIR}/hello-from-raw.env"
    37          data        = <<EOH
    38  HELLO_FROM={{env "NOMAD_TASK_NAME"}}
    39  EOH
    40          env         = true
    41        }
    42  
    43        resources {
    44          cpu    = 128
    45          memory = 64
    46        }
    47  
    48      }
    49  
    50      task "docker" {
    51        driver = "docker"
    52        config {
    53          image   = "busybox:1"
    54          command = "/bin/sh"
    55          args    = ["-c", "sleep 300"]
    56        }
    57  
    58        artifact {
    59          source      = "https://google.com"
    60          destination = "../alloc/google2.html"
    61        }
    62  
    63        template {
    64          destination = "${NOMAD_ALLOC_DIR}/${NOMAD_TASK_NAME}.env"
    65          data        = <<EOH
    66  {{env "NOMAD_ALLOC_DIR"}}
    67  EOH
    68        }
    69  
    70        template {
    71          source      = "${NOMAD_ALLOC_DIR}/hello-from-raw.env"
    72          destination = "${NOMAD_LOCAL_DIR}/hello-from-raw.env"
    73          env         = true
    74        }
    75  
    76        resources {
    77          cpu    = 128
    78          memory = 64
    79        }
    80      }
    81  
    82      task "exec" {
    83        driver = "exec"
    84        config {
    85          command = "/bin/sh"
    86          args    = ["-c", "sleep 300"]
    87        }
    88  
    89        artifact {
    90          source      = "https://google.com"
    91          destination = "${NOMAD_ALLOC_DIR}/google3.html"
    92        }
    93  
    94        template {
    95          destination = "${NOMAD_ALLOC_DIR}/${NOMAD_TASK_NAME}.env"
    96          data        = <<EOH
    97  {{env "NOMAD_ALLOC_DIR"}}
    98  EOH
    99        }
   100  
   101        template {
   102          source      = "${NOMAD_ALLOC_DIR}/hello-from-raw.env"
   103          destination = "${NOMAD_LOCAL_DIR}/hello-from-raw.env"
   104          env         = true
   105        }
   106  
   107        resources {
   108          cpu    = 128
   109          memory = 64
   110        }
   111      }
   112  
   113    }
   114  }