Closed madsboddum closed 7 months ago
We found a workaround for this by simply defining some tags in nomad_consul_tags
, like so:
nomad_consul_tags:
- test1
- test2
... which makes the consul Block look like this:
consul {
# The address to the Consul agent.
address = "192.168.80.48:8500"
ssl = false
ca_file = ""
cert_file = ""
key_file = ""
token = ""
# The service name to register the server and client with Consul.
server_service_name = "nomad-servers"
client_service_name = "nomad-clients"
tags = ["test1", "test2"]
# Enables automatically registering the services.
auto_advertise = true
# Enabling the server and client to bootstrap using Consul.
server_auto_join = true
client_auto_join = true
}
It is now formatted as an actual array instead of an object.
A possible fix could be changing the default value for nomad_consul_tags
, perhaps?
https://github.com/ansible-community/ansible-nomad/blob/master/defaults/main.yml#L163C1-L163C18
### Consul
nomad_use_consul: false
nomad_consul_address: "localhost:8500"
nomad_consul_ssl: false
nomad_consul_ca_file: ""
nomad_consul_cert_file: ""
nomad_consul_key_file: ""
nomad_consul_token: ""
nomad_consul_servers_service_name: "nomad-servers"
nomad_consul_clients_service_name: "nomad-clients"
nomad_consul_tags: {} # <----- THIS
Simply having:
nomad_consul_tags: []
Solves the problem for us.
consul {
# The address to the Consul agent.
address = "192.168.80.32:8500"
ssl = false
ca_file = ""
cert_file = ""
key_file = ""
token = ""
# The service name to register the server and client with Consul.
server_service_name = "nomad-servers"
client_service_name = "nomad-clients"
tags = []
# Enables automatically registering the services.
auto_advertise = true
# Enabling the server and client to bootstrap using Consul.
server_auto_join = true
client_auto_join = true
}
Same issue with Nomad 1.7.x
nomad_consul_tags: []
really solves this problem.
@rndmh3ro could you please change this line in defaults/main.yml
?
@sas1024, would you mind creating a PR for this? :)
@rndmh3ro sure, done :)
fixed by #190
I just used the new version of the role on our Nomad 1.7.3 agents without the nomad_consul_tags: []
workaround and I can confirm that it works now.
Thanks!
I just tried to upgrade from 1.6.3 to the new 1.7.0 release.
The consul Block in /etc/nomad.d/base.hcl looks like this:
It seems like
tags
can no longer be {} for whatever reason. Link to docs for convenience: https://developer.hashicorp.com/nomad/docs/configuration/consul#tags