I am building a list with output stored from a uri call:
`
-
name: Get hostgroup info
uri:
url: “{{baseurl}}views/host-groups?$query=hostGroup.storageDeviceId%20eq%20’{{ui}}'%20and%20hostGroup.hostGroupName%20in%20[{{vmc02}}]”
method: get
validate_certs: no
headers:
Authorization: “Session {{login.json.token}}”
Accept: “application/json”
Content-Type: “application/json”
register: hostgroups -
name: create list of hostgroups ids
set_fact:
hostgroupnum_l: “{{hostgroupnum_l}} + [‘{{item.hostGroup.hostGroupNumber}}’]”
with_items: “{{hostgroups.json.data}}”
`
But when the data is debuged it gives me this difference if i look at one item or multiple:
`
TASK [debug hostgroup list object] ******************************************************************************************************************************************************************
ok: [localhost] => {
“msg”: [
“10”,
“11”,
“12”,
“13”,
“14”,
“15”,
“16”,
“9”
]
}
TASK [debug hostgroupnumber output] *****************************************************************************************************************************************************************
ok: [localhost] => {
“msg”: “u’10’”
}
And this error when the next uri call attempts to use it, notice, how at the end i puts the list in unicode format, and the url does not know how to interpret that.
`
TASK [list sessions for 886000428027 - ams] *********************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “connection”: “close”, “content”: “\n\n400 Bad Request\n\n
Bad Request
\nYour browser sent a request that this server could not understand.
\n
`
Thoughts?
`