Error message as "msg": "Status code was 401 and not [202]: HTTP Error 401: Unauthorized",

315 views
Skip to first unread message

Vijay Ravindran

unread,
Jan 3, 2020, 8:59:38 AM1/3/20
to Ansible Project
Hello Team


The below error msg keep on coming 

"msg": "Status code was 401 and not [202]: HTTP Error 401: Unauthorized",  as i use URI for enabling a POST operation via REST API



Really seeking your help please.

Thanks


---------------------------------------

<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/vijay/.ansible/tmp/ansible-tmp-1578054950.02-218776801513341 `" && echo ansible-tmp-1578054950.02-218776801513341="` echo /home/vijay/.ansible/tmp/ansible-tmp-1578054950.02-218776801513341 `" ) && sleep 0'
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/net_tools/basics/uri.py
Pipelining is enabled.
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/vijay/.ansible/tmp/ansible-tmp-1578054950.02-218776801513341/ > /dev/null 2>&1 && sleep 0'
FAILED - RETRYING: Day1 Management IP Address update (2 retries left).Result was: {
    "attempts": 1,
    "changed": false,
    "connection": "close",
    "content": "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>401 Unauthorized</title>\n</head><body>\n<h1>Unauthorized</h1>\n<p>This server could not verify that you\nare authorized to access the document\nrequested.  Either you supplied the wrong\ncredentials (e.g., bad password), or your\nbrowser doesn't understand how to supply\nthe credentials required.</p>\n</body></html>\n",
    "content_length": "381",
    "content_type": "text/html; charset=iso-8859-1",
    "date": "Fri, 03 Jan 2020 07:28:40 GMT",
    "elapsed": 1,
    "invocation": {
        "module_args": {
            "attributes": null,
            "backup": null,
            "body": {
                "gateway": "10.234.108.1",
                "ipAddress": "10.234.108.79",
                "netmask": "255.255.255.128"
            },
            "body_format": "json",
            "client_cert": null,
            "client_key": null,
            "content": null,
            "creates": null,
            "delimiter": null,
            "dest": null,
            "directory_mode": null,
            "follow": false,
            "follow_redirects": "safe",
            "force": false,
            "force_basic_auth": false,
            "group": null,
            "headers": {
                "Accept": "application/json",
                "Content-Type": "application/json",
                "EMC-CSRF-TOKEN": "B3pGe4mX9AYoxBjI6J3Sa/ymUd94/1+l1S6lL7XesoectTMtcBwfqtSMRzPI2QcFRZtiWK16kDqwrdIHllmPjGHH3XsHZr/9/+ylc6a2cgs=",
                "Set-Cookie": {
                    "CASTGC": "TGT-66-Tg5ht9eLnG3RpFHiaaLheqdl4hYJTdxY5IzwDNDEjhKTbV3oKe-Unisphere",
                    "JSESSIONID": "A6AC6C9E86390A9CF0CB27C127D60B04",
                    "MOD_AUTH_CAS_S": "8ff64a0116fc3f9521b7379e5a9f418957561742",
                    "mod_sec_emc": "value2&76397c3da4e3cd7beca0094aa2c71cbf881a1cb0a89bd2635e30530c34846cf6&value1&MbXxnZOhDEVZFJuUxQGnCZ3Q1UcZPpcbCx7T6XsMZONXeXe7znzqojc%2BvUfyimgv%0A&value3&1"
                },
                "X-EMC-REST-CLIENT": "true"
            },
            "http_agent": "ansible-httpget",
            "method": "POST",
            "mode": null,
            "owner": null,
            "regexp": null,
            "remote_src": null,
            "removes": null,
            "return_content": true,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": null,
            "status_code": [
                "202"
            ],
            "timeout": 30,
            "unix_socket": null,
            "unsafe_writes": null,
            "url_password": null,
            "url_username": null,
            "use_proxy": true,
            "validate_certs": false
        }
    },
    "msg": "Status code was 401 and not [202]: HTTP Error 401: Unauthorized",
    "redirected": false,
    "retries": 3,
    "server": "Apache",
    "status": 401,
    "strict_transport_security": "max-age=63072000; includeSubdomains;",
    "www_authenticate": "X-EMC-CAS-V2 realm=\"EMC CAS\"",
    "x_frame_options": "SAMEORIGIN"

--------------------------------------

Stefan Hornburg (Racke)

unread,
Jan 3, 2020, 9:53:21 AM1/3/20
to ansible...@googlegroups.com
On 1/3/20 2:59 PM, Vijay Ravindran wrote:
> Hello Team
>
>
> The below error msg keep on coming 
>
> "msg": "Status code was 401 and not [202]: HTTP Error 401: Unauthorized",  as i use URI for enabling a POST operation
> via REST API
>
>
>
> Really seeking your help please.
>
> Thanks

Vijav it is all there in the error messages ... you need to provide the proper credentials.

Regards
Racke

>
>
> ---------------------------------------
>
> /<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
> /home/vijay/.ansible/tmp/ansible-tmp-1578054950.02-218776801513341 `" && echo
> ansible-tmp-1578054950.02-218776801513341="` echo /home/vijay/.ansible/tmp/ansible-tmp-1578054950.02-218776801513341 `"
> ) && sleep 0'/
> /Using module file /usr/lib/python2.7/dist-packages/ansible/modules/net_tools/basics/uri.py/
> /Pipelining is enabled./
> /<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 && sleep 0'/
> /<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/vijay/.ansible/tmp/ansible-tmp-1578054950.02-218776801513341/ > /dev/null
> 2>&1 && sleep 0'/
> /FAILED - RETRYING: Day1 Management IP Address update (2 retries left).Result was: {/
> /    "attempts": 1,/
> /    "changed": false,/
> /    "connection": "close",/
> /    "content": "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>401
> Unauthorized</title>\n</head><body>\n<h1>Unauthorized</h1>\n<p>This server could not verify that you\nare authorized to
> access the document\nrequested.  Either you supplied the wrong\ncredentials (e.g., bad password), or your\nbrowser
> doesn't understand how to supply\nthe credentials required.</p>\n</body></html>\n",/
> /    "content_length": "381",/
> /    "content_type": "text/html; charset=iso-8859-1",/
> /    "date": "Fri, 03 Jan 2020 07:28:40 GMT",/
> /    "elapsed": 1,/
> /    "invocation": {/
> /        "module_args": {/
> /            "attributes": null,/
> /            "backup": null,/
> /            "body": {/
> /                "gateway": "10.234.108.1",/
> /                "ipAddress": "10.234.108.79",/
> /                "netmask": "255.255.255.128"/
> /            },/
> /            "body_format": "json",/
> /            "client_cert": null,/
> /            "client_key": null,/
> /            "content": null,/
> /            "creates": null,/
> /            "delimiter": null,/
> /            "dest": null,/
> /            "directory_mode": null,/
> /            "follow": false,/
> /            "follow_redirects": "safe",/
> /            "force": false,/
> /            "force_basic_auth": false,/
> /            "group": null,/
> /            "headers": {/
> /                "Accept": "application/json",/
> /                "Content-Type": "application/json",/
> /                "EMC-CSRF-TOKEN":
> "B3pGe4mX9AYoxBjI6J3Sa/ymUd94/1+l1S6lL7XesoectTMtcBwfqtSMRzPI2QcFRZtiWK16kDqwrdIHllmPjGHH3XsHZr/9/+ylc6a2cgs=",/
> /                "Set-Cookie": {/
> /                    "CASTGC": "TGT-66-Tg5ht9eLnG3RpFHiaaLheqdl4hYJTdxY5IzwDNDEjhKTbV3oKe-Unisphere",/
> /                    "JSESSIONID": "A6AC6C9E86390A9CF0CB27C127D60B04",/
> /                    "MOD_AUTH_CAS_S": "8ff64a0116fc3f9521b7379e5a9f418957561742",/
> /                    "mod_sec_emc":
> "value2&76397c3da4e3cd7beca0094aa2c71cbf881a1cb0a89bd2635e30530c34846cf6&value1&MbXxnZOhDEVZFJuUxQGnCZ3Q1UcZPpcbCx7T6XsMZONXeXe7znzqojc%2BvUfyimgv%0A&value3&1"/
> /                },/
> /                "X-EMC-REST-CLIENT": "true"/
> /            },/
> /            "http_agent": "ansible-httpget",/
> /            "method": "POST",/
> /            "mode": null,/
> /            "owner": null,/
> /            "regexp": null,/
> /            "remote_src": null,/
> /            "removes": null,/
> /            "return_content": true,/
> /            "selevel": null,/
> /            "serole": null,/
> /            "setype": null,/
> /            "seuser": null,/
> /            "src": null,/
> /            "status_code": [/
> /                "202"/
> /            ],/
> /            "timeout": 30,/
> /            "unix_socket": null,/
> /            "unsafe_writes": null,/
> /            "url": "https://10.234.108.69/api/instances/mgmtInterface/mgmt_ipv4/action/modify",/
> /            "url_password": null,/
> /            "url_username": null,/
> /            "use_proxy": true,/
> /            "validate_certs": false/
> /        }/
> /    },/
> /    "location":
> "https://10.234.108.69/cas/login?service=https%3a%2f%2f10.234.108.69%2fapi%2finstances%2fmgmtInterface%2fmgmt_ipv4%2faction%2fmodify%3fcasAction%3dlogin",/
> /    "msg": "Status code was 401 and not [202]: HTTP Error 401: Unauthorized",/
> /    "redirected": false,/
> /    "retries": 3,/
> /    "server": "Apache",/
> /    "status": 401,/
> /    "strict_transport_security": "max-age=63072000; includeSubdomains;",/
> /    "url": "https://10.234.108.69/api/instances/mgmtInterface/mgmt_ipv4/action/modify",/
> /    "www_authenticate": "X-EMC-CAS-V2 realm=\"EMC CAS\"",/
> /    "x_frame_options": "SAMEORIGIN"/
>
> --------------------------------------
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7216182b-5edf-4f76-9ea1-e942da845518%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7216182b-5edf-4f76-9ea1-e942da845518%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc
Reply all
Reply to author
Forward
0 new messages