github.com/hernad/nomad@v1.6.112/e2e/consultemplate/input/nomad_provider_service_lookup.nomad (about) 1 # Copyright (c) HashiCorp, Inc. 2 # SPDX-License-Identifier: MPL-2.0 3 4 job "nomad_provider_service_lookup" { 5 datacenters = ["dc1"] 6 type = "service" 7 8 constraint { 9 attribute = "${attr.kernel.name}" 10 value = "linux" 11 } 12 13 group "nomad_provider_service_lookup" { 14 15 task "test" { 16 driver = "raw_exec" 17 18 config { 19 command = "bash" 20 args = ["-c", "sleep 15000"] 21 } 22 23 template { 24 data = <<EOH 25 {{ range nomadServices }} 26 service {{ .Name }} {{ .Tags }}{{ end }} 27 EOH 28 29 destination = "${NOMAD_TASK_DIR}/services.conf" 30 change_mode = "restart" 31 } 32 33 template { 34 data = <<EOH 35 {{ range nomadService "default-nomad-provider-service-primary" }} 36 service {{ .Name }} {{ .Tags }} {{ .Datacenter }} {{ .AllocID }}{{ end }} 37 EOH 38 39 destination = "${NOMAD_TASK_DIR}/service.conf" 40 change_mode = "noop" 41 } 42 } 43 } 44 }