Skip to content

Instantly share code, notes, and snippets.

@lmayorga1980
Created November 7, 2018 15:32
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 lmayorga1980/6a41250f18d3130c7f58d6692c41d751 to your computer and use it in GitHub Desktop.
Save lmayorga1980/6a41250f18d3130c7f58d6692c41d751 to your computer and use it in GitHub Desktop.
Nomad Basics

Nomad Basic Infrastructure for Batch Jobs

List of Servers

  • 1 Nomad Server
  • 2 Nomad Clients

Job Definition

Download Packer, Unzip and Print Version Number

job "run-batch-job"{
  datacenters = ["dc1"]

  type = "batch"

  constraint {
    attribute = "${attr.kernel.name}"
    value     = "linux"
  }

  group "uptime" {
    count = 1
    task "uptime"{
      driver = "exec"

      config {
        command = "/tmp/packer"
        args    = ["--version"]
      }

      artifact {
        source = "https://releases.hashicorp.com/packer/1.3.2/packer_1.3.2_linux_amd64.zip"
        destination = "/tmp"

         options {
          checksum = "md5:a7d1ba188b5fcac5b0ed9f4f24b362ce"
        }
      }

    }
  }
}

Run Nomad Job

nomad job plan <nomad-job>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment