Just realized my mistake...
This is a list so a simple |join(' ') did the trick...
{{ item.keys()|join(' ') }}
-Nico
On Sunday, July 10, 2016 at 12:02:00 PM UTC-7, Nico wrote:
>
> Hello
>
> I'am using the .keys function to get the key name out of a dict.
> {{ item.keys() }}
> which output:
> ["MyKeysName"]
>
>
> Now, I'am trying to remove the *["* and *"]* so that only *MyKeysName *is
> left.
> I have been looking at the regex_replace filter but not being an expert at
> regex I'am having trouble getting it to work.
> Is regex_replace filter the best option here or is there another
> recommended way?
> Any tips on what the regex should look like?
>
> [a-zA-Z]+ should allow me to extract only the characters leaving the []
> and " out correct?
>
> {{ item.keys()|regex_replace('^[a-zA-Z]+$','\\1') }}
>
>
> Running Ansible 2.2.0
> Any help or guidance is appreciated.
>
> Thanks
>
--
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/34029504-8fa6-451c-8ad9-05e102f2af4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.