How to register Nomad itself at consul?

There is consul stanza and tags option in nomad config, but these tags applying to each nomad-server-service(serf, rpc and http), registered at consul:

I need to attach traefik tag lable only to http service. Is there any options?

Hi @kinnalru; this is not currently possible but worth discussing to enable this type of use case. Would you be able to raise this as a feature request against the Nomad repository?

jrasell and the Nomad team

What we currently do is put a json snippet for consul into /etc/consul.d during startup on the server.
something like:

echo $(cat <<EOF
    "service": {
      "ID": "nomad-ui-${HOST_ID}",
      "Name": "nomad-ui",
      "Tags": [
        "traefik.http.middlewares.nomad-ui-auth.basicauth.users=$(VAULT_TOKEN=$VAULT_TOKEN VAULT_ADDR=$VAULT_ADDR vault kv get -format=json $vaultpath | jq -r '. | "\(\("')",
      "Port": 4646,
      "Check": {
        "HTTP": "http://localhost:4646/ui/",
        "Interval": "10s"
) | tee /etc/consul.d/nomad-ui-service.json
pkill -SIGHUP consul || true