Hello,
I have a couple of curl commands that I'm trying to convert to
either the get_url module or uri module. I was hoping someone here
might be able to help.
Here are the commands I'm trying to convert:
1. Gets the mojolicious cookie:
curl -vLks -X POST -d 'u=" .
$user . "' -d 'p=" . $pass . "' " . $url . "/login -o /dev/null
2>&1 | grep Set-Cookie | awk '{print \$3}'
2. Downloads a file:
curl -k -H "Cookie:
mojolicious=eyJhdXRoX2RhdGEiOiJoYmVhdHR5IiwiZXhwaXJlcyI6MTQzMjMyMjkwOH0---2231daa1152b807376209174bb4836e2ed8c623b"
"
https://<some_server>/iso_download?osversion=centos66&hostname=<hostname>&rootpass=<some_pass>&dhcp=no&ipaddr=<some_ip>&netmask=<some_netmask>&gateway=<some_gateway>&ip6_address=<some_url_encoded_ipv6_address>&ip6_gateway=<some_url_encoded_ipv6_gw>&dev=p2p1&mtu=1500&ondisk=sdy"
-o <hostname>.iso
Here is the playbook I've tried so far:
- name: Login
uri: url={{ traffic_ops_url }}/login follow_redirects=all
method=POST user={{ traffic_ops_user }} password={{ traffic_ops_pass
}}
register: login
- name: Get ISO
uri: url:{{ traffic_ops_url
}}/iso_download?osversion=centos66&hostname={{inventory_hostname}}&rootpass={{temp_root_pass}}&dhcp=no&ipaddr={{ipv4}}&netmask={{ipv4_netmask}}&gateway={{ipv4_gw}}&ip6_address={{ipv6}}&ip6_gateway={{ipv6_gw}}&dev=p2p1&mtu=1500&ondisk=sdy
return_content=yes method=GET HEADER_Cookie="{{login.set_cookie}}"
dest={{inventory_hostname}}.iso
The second command doesn't work because there is no variable
{{login.set_cookie}}
Thanks,
Hank