I am trying to run below code and able to get the SID which will be passed to the URL but not sure why it is adding dash when I try to get the SID value using below code. I need to pass just the value to the URL.
Its basically about how to convert the dictionary item to a string, not sure how to do :|
- set_fact:
regexp1: '\"sid"\: \"([^"]+)'
- set_fact:
ssid: "{{ dict | selectattr('Details','contains',item) | to_nice_json | regex_search(regexp1,'\\1')}}"
- debug: msg="{{ssid}}"
Output
msg:
- 01234567899
sid: 01234567899
is the line I have in my dict.
It is passing the SID enclosed in square brackets with single quotes.
https://abc.service-now.com/api/now/table/sc_task/['01234567899']
I am expecting to see
https://abc.service-now.com/api/now/table/sc_task/01234567899