Skip to content

Conversation

@vsarunas
Copy link

@vsarunas vsarunas commented Sep 23, 2025

SUMMARY

Produce a valid json config on latest Ansible versions.

Fixes #621

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

Task

ADDITIONAL INFORMATION

The produced json is not valid

cat /etc/consul/config.json
"{\n    \n            \"datacenter\": \"dc1\",\n    \"domain\": \"consul\",\n                \"performance\": {\"raft_multiplier\": 1, \"leave_drain_time\": \"5s\", \"rpc_hold_timeout\": \"7s\"},\n\n        \"bind_addr\":
[...]

Validate json, and then write out json properly.

Requires #620 as otherwise the produced config is not valid.

owner: "{{ consul_user }}"
group: "{{ consul_group }}"
content: "{{ lookup('template', consul_config_template_path, convert_data=True) | to_nice_json }}"
content: "{{ lookup('template', consul_config_template_path, convert_data=True) | from_json | to_nice_json }}"
Copy link

@kochen kochen Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works only in combination with: #620

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • it should be adjusted in line 35 in case there are custom configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrectly formatted config.json is being generated

2 participants