How to escape doublequote and curly braces

i want to have an output as follows:

‘{“components”:“my_variable”}’ from my playbook.

  • name: Review the Joined List
    set_fact:
    jetty_c: “{{ ''{"\components”:“' + my_joined_list + '”}‘’ }}"

Its giving me error.
Can you guys pls help.

i want to have an output as follows:

'{"components":"my_variable"}' from my playbook.

- name: Review the Joined List
set_fact:
jetty_c: "{{ '\'{\"\components":"\' + my_joined_list + '"}'' }}"

Its giving me error.
Can you guys pls help.

What is the exact error? What are you trying to achieve ?

Regards
         Racke

The value of my “my_joined_list”
is : idp:25.0.1,das:25.0.0

Now i want my o/p to be as follows:

‘{“components”:“idp:25.0.1,das:25.0.0”}’

Error is as below

ERROR! Syntax Error while loading YAML.
found unknown escape character

The error appears to be in ‘/root/raka-tests/raka-cac-components-parsing.yml’: line 145, column 29, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

set_fact:
jetty_c: “{{ ''{"\components”:“' + my_joined_list }}”
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value.

This should work

  jetty_c: '{{ {"components": my_joined_list} }}'

I was able to make it work:

jetty_c: “‘{"components":"{{ my_updated_list}}"}’”

But now iam facing one more issue: i am trying to debug the contents to file but only the last item is getting appended

  • name: Create Jetty Components
    set_fact:
    jetty_c: “‘{"components":"{{ my_updated_list }}"}’”
    with_items: “{{ JETTY_Record }}”

  • name: Debug the Jetty Components
    debug:
    msg: “{{ jetty_c }}”

What am i missing