What are you trying to achieve?  Do you want `uri` to follow the 302?

The default for `follow_redirects` for the `uri` module is "safe". "safe"
means that it will only follow certain redirects if the request is a HEAD
or GET.  You are performing a POST so it does not follow the redirect.

You could add `follow_redirects: all` to get it to follow the redirect.

On Wed, Apr 13, 2016 at 3:59 PM, GBANE FETIGUE <[email protected]> wrote:

>
>
> Hi Folks,
>    I am writing that ansible to register Mule server .It's fine you don't
> Mule I do believe you can still help me. Here is the Error :
>
> failed: [ip-172-31-57-168.ec2.internal] => {"content": "",
> "content_length": "0", "date": "Wed, 13 Apr 2016 20:23:32 GMT", "failed":
> true, "location": "
> http://ec2-54-165-243-43.compute-1.amazonaws.com:8080/mmc-console-3.6.2/login.jsp;jsessionid=F7534E8A910F63C9AE877723F908F55E";,
> "redirected": false, "server": "Apache-Coyote/1.1", "set_cookie":
> "JSESSIONID=F7534E8A910F63C9AE877723F908F55E; Path=/mmc-console-3.6.2/;
> HttpOnly", "status": 302}
> msg: Status code was not [200]
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP
> ********************************************************************
>            to retry, use: --limit @/root/master.retry
>
> ip-172-31-57-168.ec2.internal : ok=32   changed=8    unreachable=0
> failed=1
>
> My Ansible  returning that error message is :
>
> - uri:
>    url:
> http://ec2-54-165-243-43.compute-1.amazonaws.com:8080/mmc-console-3.6.2/api/servers
>    method: POST
>    user: admin
>    password: admin
>    return_content: yes
>    body: "{\"name\": \"ec2-52-207-234-33.compute-1.amazonaws.com\",
> \"agentUrl\": \"http//
> ec2-52-207-234-33.compute-1.amazonaws.com:7777/mmc-support\
> <http://ec2-52-207-234-33.compute-1.amazonaws.com:7777/mmc-support%5C>",
> \"mmc_group_id\": \"local$4459223d-fa52-44b8-bdb4-7409fe96dd77\"}"
>    body_format: json
>
> In addition, whenever I am adding status_code: 302 it run fine  but that's
> not what I want to do . Any ideas is Welcome !!!!
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/17d6c885-0e64-4e62-ae48-3692205b4e01%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/17d6c885-0e64-4e62-ae48-3692205b4e01%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v-eudb%3DdQbVR26oQT-YzNE8P_QKu5Rf_jXaFaep%3DF88Zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to