Here is the thing:

vars:
test_data:
  {% set testdata={} -%}
    {{ tesdata | combine({'a': 10, 'b': 20}, recursive='True') }}
  {{ testdata}}

task:
- name: value of test_data
  debug:
    var=test_data

The output is:

ok: [10.3.12.2] => {
      "test_data" : "{'a': 10, 'b': 20}*\n{}\n"*

The extra char is something i dont want. I get the feeling I am missing
something basic.
Any ideas ?

Regards,
Punit




On Fri, 21 Jun 2019 at 10:52, Dick Visser <[email protected]> wrote:

> What do you mean by ‘not working’?
> What do you want to achieve?
>
>
> On Fri, 21 Jun 2019 at 07:42, Punit Jain <[email protected]>
> wrote:
>
>> But it is not working. Adding extra {} . Am I doing something wrong
>>
>> On Fri, 21 Jun 2019, 09:55 Dick Visser, <[email protected]> wrote:
>>
>>>
>>>
>>> On Thu, 20 Jun 2019 at 19:50, Punit Jain <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Seems I am missing something really simple.
>>>>
>>>> ldap_data: |
>>>>   {% set ldapdata = {} -%}
>>>>   {% if ldap_content is defined -%}
>>>>     {{ ldapdata | combine({'a':10}, recursive='True') }}
>>>>   {%- endif -%}
>>>>  {{ldapdata}}
>>>>
>>>> populates ldap_data with value:
>>>> "ldap_data": "{'a': 10}*{}\*n"
>>>>
>>>> Dont understand why this last {} appears in output ?
>>>>
>>>
>>>
>>> First you set ldapdata to {}, and at the end you say {{ldapdata}}. So
>>> that makes sense.
>>>
>>>
>>>
>>>
>>>> Thanks
>>>> Punit
>>>>
>>>> --
>>>> 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/CAFXWBQKEmjsQ3PNz-hG5QrqfNCKepooe0rA2tsc_ijT%3D8Taevw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CAFXWBQKEmjsQ3PNz-hG5QrqfNCKepooe0rA2tsc_ijT%3D8Taevw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> Sent from a mobile device - please excuse the brevity, spelling and
>>> punctuation.
>>>
>>> --
>>> 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/CAL8fbwNjCOn9p%3DZ36Ru0z_snwRcAGtXFPuYgLmWuLMN%3DwjRbfw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwNjCOn9p%3DZ36Ru0z_snwRcAGtXFPuYgLmWuLMN%3DwjRbfw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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/CAFXWBQ%2BKMqbfKrJd5zsvyHRioJG_LTLegYga95ATENW3_dtUDQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAFXWBQ%2BKMqbfKrJd5zsvyHRioJG_LTLegYga95ATENW3_dtUDQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> 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/CAL8fbwMrdgb%2ByKFbupQ_0TcGaBRVHeEAON4tJxpUXtJd_bUqxA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwMrdgb%2ByKFbupQ_0TcGaBRVHeEAON4tJxpUXtJd_bUqxA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFXWBQ%2BqD6KCzn0XN9aP3%3DaFDW1BUv5wWs1BZ2DTtRviY%2BHLkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to