Skip to content

Incorrectly formatted config.json is being generated #621

@vsarunas

Description

@vsarunas
SUMMARY

Using fresh Ansible core, when piping template config to to_nice_json produces invalid json:

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\":
[...]

On older Ansible releases this works fine.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Task

ANSIBLE VERSION
 ansible --version
ansible [core 2.19.2]
  config file = None
  configured module search path = ['/Users/ordo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/12.0.0/libexec/lib/python3.13/site-packages/ansible
  ansible collection location = /Users/ordo/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.13.7 (main, Aug 14 2025, 11:12:11) [Clang 17.0.0 (clang-1700.3.19.1)] (/opt/homebrew/Cellar/ansible/12.0.0/libexec/bin/python)
  jinja version = 3.1.6
  pyyaml version = 6.0.2 (with libyaml v0.2.5)
COLLECTION VERSION

Master branch, d5d5a0286bd45a2e3c68119e269c946176500f3a.

CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE

Install latest ansible and generate minimal Consul configuration.

EXPECTED RESULTS

A valid json file

ACTUAL RESULTS

Misformated config file:

head -n 1 /etc/consul/config.json
"{\n    \n            \"datacenter\": \"dc1\",\n    \"domain\": \"consul\",\n                \"performance\": 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions