I am trying to pass JSON string in environment.

- name: Start {{service_name}}
  shell: "<<starting springboot jar>> --server.port={{service_port}}\""
  environment:
    - SPRING_APPLICATION_JSON: 
'{"test-host.1":"{{test_host_1}}","test-host.2":"{{test_host_2}}"}'

test_host_1 is 172.31.00.00
test_host_2 is 172.31.00.00

But when in spring logs, I get JSON parse exception where it prints

Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected 
character (''' (code 39)): was expecting double-quote to start field name
 at [Source: {'test-host.1': '172.31.00.00', 'test-host.2': '172.31.00.00'}; 
line: 1, column: 3]


As seen, double quotes are converted to single quotes !!!

I tried escaping double quotes but with no luck.

Any idea why it happens, or any work around?

Thanks,
Nirav

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/40ae21e4-f82f-4f1b-b76b-2e18be79de32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to