ansible 2.6.0 (devel da5cf72236) last updated 2018/02/14 14:29:49 (GMT +200)

The task seems obvious at first glance but it appears to be difficult to 
implement in this context.
The string is:
host_meta: "<XRD xmlns=''>\n    
<Link rel='restconf' href='/restconf'/>\n</XRD>"

I need to extract the values of rel and href into api_release and api_root.
I unsuccessfully tried the following:
- set_fact: api_release="{{ host_meta | regex_replace('^.* rel=(.*) .*$', 
'\\1') }}"
  when: host_meta is defined

- set_fact: api_root="{{ host_meta | regex_replace('^.* href=(.*)/>.*$', 
'\\1') }}"
  when: host_meta is defined

Both variables contain the whole string instead of the corresponding 
substring, which should be:
api_release: 'restconf'
api_root: /restconf

I have already successfully used this filter in other contexts. 
What am I missing here? Is the filter confused by the string?

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 post to this group, send email to
To view this discussion on the web visit
For more options, visit

Reply via email to