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?

Thanks,
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.enable=true",
        "traefik.http.middlewares.nomad-ui-auth.basicauth.users=$(VAULT_TOKEN=$VAULT_TOKEN VAULT_ADDR=$VAULT_ADDR vault kv get -format=json $vaultpath | jq -r '. | "\(.data.data.username):\(.data.data.hash)"')",
        "traefik.http.routers.nomad-ui-http.rule=Host(\`nomadservername\`)",
        "traefik.http.routers.nomad-ui-http.middlewares=nomad-ui-auth,redirect-https@consul,whitelist-office-ips@consul",
        "traefik.http.routers.nomad-ui-https.rule=Host(\`nomadservername\`)",
        "traefik.http.routers.nomad-ui-https.tls=true",
        "traefik.http.routers.nomad-ui-https.middlewares=nomad-ui-auth,redirect-https@consul,whitelist-office-ips@consul"
      ],
      "Port": 4646,
      "Check": {
        "HTTP": "http://localhost:4646/ui/",
        "Interval": "10s"
      }
    }
  }
EOF
) | tee /etc/consul.d/nomad-ui-service.json
pkill -SIGHUP consul || true