Hi all,
I have a working curl command that I’ve been trying to get into an ansible playbook in a testing environment. I’ve found several posts on various forums for similar situations, but not the one I’m working with, so my attempts are still erroring. I have the curl below, which when run on the cli works correctly.
Perhaps it is only a problem in your example but in the example you appear to use an IP address for by a port. (x.x.x.x:5601) but in the playbook you seem to use a hostname.
Could it be a name resolution issue?
Does it work if you hardcode the exact same URL in the playbook?
Another thing I noticed is that the URL in the playbook has a suffix of -ki01 (url: “https://{{ region }}-ki01:5601/api/spaces/space”).
Is that intentional?
nschende
(Nick Schendel - Solution Architect, Red Hat)
6
Sure, I will grab my entire example task in just a bit here. Happy to share if it might help.
nschende
(Nick Schendel - Solution Architect, Red Hat)
7
Sorry for the delay, I meant to grab the example when I got back to my desk and lost track of it.
Here is an example I am using currently that works
name: restore disk from snapshot
uri:
url: https://{{ cluser_ip }}/api/internal/vmware/vm/snapshot/{{snapshotlist.json.data[0].id}}/mount_disks
headers:
Content-Type: “application/json”
Authorization: “Bearer {{ authtoken.json.token }}” # pass authentication token from earlier rather than basic auth
body:
targetVmId: ‘{{ target_vm_id }}’ # VM to restore the disk snapshots to
vmdkIds: [‘{{ snapshotdetails.json.snapshotDiskDetails[1].virtualDiskId }}’] # Rubrik wants an array of vmdk ID’s to restore, without it will restore all in the snapshot
body_format: json
method: POST
status_code: 202 # Rubrik returns 202 on sucess.
return_content: yes
validate_certs: yes
tags: restore
delegate_to: localhost
become: no