ansible-consul icon indicating copy to clipboard operation
ansible-consul copied to clipboard

Configuration files are not in json format

Open zet694 opened this issue 7 months ago • 3 comments

Hi! When I use the default templates they come out in str format and not json as I expect, why can this happen?

root@consul-0:~# jq . /etc/consul/bootstrap.json 

"{'datacenter': 'dev', 'domain': 'consul', 'performance': {'raft_multiplier': 1, 'leave_drain_time': '5s', 'rpc_hold_timeout': '7s'}, 'bind_addr': '10.1.32.31', 'advertise_addr': '10.1.32.31', 'advertise_addr_wan': '10.1.32.31', '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': 8500, 'https': -1, 'serf_lan': 8301, 'serf_wan': 8302, 'server': 8300, 'grpc': -1, 'grpc_tls': -1}, 'raft_protocol': 3, 'data_dir': '/opt/consul', 'log_level': 'INFO', 'log_file': '/var/log/consul/consul.log', 'log_rotate_bytes': 0, 'log_rotate_duration': '24h', 'log_rotate_max_files': 0, 'disable_update_check': False, 'enable_script_checks': False, 'enable_local_script_checks': False, 'encrypt': 'nJr7+QmTlKyksbo1qiJFmCC2bQ4VCyAMjp2RQ33osYk=', 'encrypt_verify_incoming': True, 'encrypt_verify_outgoing': True, 'retry_interval': '30s', 'retry_max': 0, 'retry_join': ['10.1.32.31'], 'server': True, 'bootstrap': True, 'retry_interval_wan': '30s', 'retry_max_wan': 0, 'primary_datacenter': 'dev', 'acl': {'enabled': True, 'default_policy': 'allow', 'down_policy': 'extend-cache', 'token_ttl': '30s', 'enable_token_persistence': True, 'tokens': {'initial_management': '80d58de9-c559-5482-b251-ab7f66ca6591', 'replication': '8b65e0c6-fd42-531b-aab0-a3c4131f4714'}}, 'ui_config': {'enabled': True}}"

This is the case with all files in which the template is used (consul.json, server.json, bootstrap.json etc).

Ansible version:

❯ ansible --version

ansible [core 2.13.12]
  config file = /Users/zet694/Zdravcity/infra/ansible/ansible.cfg
  configured module search path = ['/Users/zet694/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/zet694/.zdravcity/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/zet694/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/zet694/.zdravcity/bin/ansible
  python version = 3.9.6 (default, Aug 11 2023, 19:44:49) [Clang 15.0.0 (clang-1500.0.40.1)]
  jinja version = 3.0.3
  libyaml = True

My variables:

---
consul_group_name: "_consul"
consul_zip_url: "https://blabla/common-infra/consul_1.16.3_linux_amd64.zip"
consul_checksum_file_url: "https://blabla/common-infra/consul_1.16.3_SHA256SUMS"
consul_version: "1.16.3"
consul_acl_enable: true
consul_acl_master_token_display: true
consul_acl_master_token: "$MY_TOKEN"
consul_debug: true
consul_datacenter: "{{ environment_name }}"
consul_encrypt_enable: true

zet694 avatar Nov 09 '23 13:11 zet694