ahh yes I should have seen you just wanted a nested var, just an FYI ~ is
similar to + but coerces the variable to a string so you don't have to do
that yourself. Usually + works but ~ is safer.
Thanks
Jordan
--
You received this message because you are subscribed to the Google Groups
Hey Jordan,
Thanks for replying!
There were "`" missing, worked beautifully after that!
- set_fact:
hosted_zone_id: "{{ dns_results | json_query('HostedZones[?Name==`' ~
hosted_zone_name ~ '.`].[Id]') | regex_replace('/hostedzone/', '') }}"
"~" escapes it, so there's no need to do a
Try this
- set_fact:
hosted_zone_id: "{{ dns_results | json_query('HostedZones[?Name==' ~
lookup('vars', hosted_zone_name) ~ '].[Id]') |
regex_replace('/hostedzone/', '') }}"
You need to escape outside of the quoted arg of json_query and then run the
lookup. Note I haven't tested this
Spoke too soon... That doesn't work either...
On Wednesday, May 23, 2018 at 10:04:16 PM UTC+2, David Villasmil wrote:
>
> Hello guys,
>
>
> I've got this set_fact:
>
> hosted_zone_id: "{{ dns_results |
> json_query('HostedZones[?Name==`mydomain.com.`].[Id]') | regex_replace
> ('/hostedzone/',
Solved!
- set_fact:
hosted_zone_id: "{{ dns_results |
json_query('HostedZones[?Name==`(lookup('vars',
hosted_zone_name)).`].[Id]') | regex_replace ('/hostedzone/', '') }}"
For future reference.
Thanks
David
On Wednesday, May 23, 2018 at 10:04:16 PM UTC+2, David Villasmil wrote:
>
>