postgresql_cluster
postgresql_cluster copied to clipboard
[Bug] Consul role templates invalid config.json
Bug description
https://github.com/vitabaks/autobase/blob/8969ea83c3210a152b1d0a9f9163841ca19ea576/automation/roles/consul/tasks/config.yml#L4 This task is supposed to generate a valid json file, but instead it generates a string, that looks like json:
+"{'datacenter': 'dc1', 'domain': 'consul', 'performance': {'raft_multiplier': 1, 'leave_drain_time': '5s', 'rpc_hold_timeout': '7s'}, 'bind_addr': '10.9.1.27', 'advertise_addr': '10.9.1.27', 'advertise_addr_wan': '10.9.1.27', 'translate_wan_addrs': False, 'client_addr': '127.0.0.1', 'addresses': {'dns': '127.0.0.1', 'http': '127.0.0.1', 'https': '127.0.0.1', 'grpc': '127.0.0.1', 'grpc_tls': '127.0.0.1'}, 'ports': {'dns': 8600, 'http': -1, 'https': 8500, 'serf_lan': 8301, 'serf_wan': 8302, 'server': 8300, 'grpc': -1, 'grpc_tls': -1}, 'raft_protocol': 3, 'data_dir': '/var/lib/consul', 'log_level': 'INFO', 'enable_syslog': True, 'syslog_facility': 'local0', 'disable_update_check': True, 'enable_script_checks': True, 'enable_local_script_checks': True, 'encrypt': 'F2FEzTOeYbsDlIclq0gPoFipHCCJFS7B0oYQefdiB8Y=', 'encrypt_verify_incoming': True, 'encrypt_verify_outgoing': True, 'tls': {'defaults': {'ca_file': '/etc/consul/tls/ca.crt', 'cert_file': '/etc/consul/tls/server.crt', 'key_file': '/etc/consul/tls/server.key', 'verify_incoming': False, 'verify_outgoing': True, 'tls_min_version': 'TLSv1_2'}, 'internal_rpc': {'verify_incoming': False, 'verify_server_hostname': False}, 'https': {'verify_incoming': False}}, 'auto_encrypt': {}, 'retry_interval': '30s', 'retry_max': 0, 'retry_join': ['10.9.12.229', '10.9.11.211', '10.9.1.27'], 'server': True, 'bootstrap': False, 'bootstrap_expect': 3, 'retry_interval_wan': '30s', 'retry_max_wan': 0, 'ui_config': {'enabled': True}}"
Expected behavior
A valid consul config.json file is being created.
Steps to reproduce
- Start consul_cluster.yml playbook
- Get an error
...
Installation method
Command line
System info
Ubuntu 24.04 Ansible 11
Additional info
No response
Is this causing an error in the Consul cluster? At least the tests are successful.
Is this causing an error in the Consul cluster? At least the tests are successful.
It leads to
failed to parse /etc/consul/config.json: json: cannot unmarshal string into Go value of type map[string]interface {}
in consul service logs
OK, I'll take a look at it later. At the same time, if I understand correctly, the consul service is working and it's just a warning in the log?
OK, I'll take a look at it later. At the same time, if I understand correctly, the consul service is working and it's just a warning in the log?
No, the error is fatal and doesn't let consul start
FAILED! => {"changed": false, "msg": "Unable to start service consul: Job for consul.service failed because the control process exited with error code.\nSee \"systemctl status consul.service\" and \"journalctl -xeu consul.service\" for details.\n"}
Feel free to suggest a PR