Issue with Ansible

Hi guys,
I have some issue with ansible I want to Convert a Json array in Ansible but still having error message here is the JSon.
curl --basic -u admin:admin -d ‘{“name” : “ms3-simple-hello-world-app” , “servers”: [ “local$d50bdc24-ff04-4327-9284-7bb708e21c25” ], “applications”: [ “local$43d12cfd-f64a-4fa9-9367-3a0109c1721d” ]}’ --header ‘Content-Type: application/json’ http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments

I use action module and shell to run the curl here is what I have done so far:

  • action: shell curl --basic -u admin:admin -d '{“name”:“ms3-simple-hello-world-app”, “servers”: [ ‘local$d50bdc24-ff04-4327-9284-7bb708e21c25’ ], “applications”: [ ‘local$43d12cfd-f64a-4fa9-9367-3a0109c1721d" ]}’ --header ‘Content-Type: application/json’ http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments
    register: deployment
  • name: what got saved
    debug: var=deployment

but I am having syntax error any ideas ?

You should check your qoutes, and make sure they are matching pair.
And you can not have a colon with a space after it in the command, this will make the yaml parser fail.

“applications”: [ **‘**local$43d12cfd-f64a-4fa9-9367-3a0109c1721d" ]}’ has non-matching quotes in your action: shell task. That one right before local needs to be a double quote, I think.

I still have the same issue any other ideas ?

  • local_action: curl --basic -u admin:admin -d ‘“name”: “ms3-test-app”’ , “servers”: [ “local$d50bdc24-ff04-4327-9284-7bb708e21c25” ] “applications”: [ “local$6444f208-f78c-4e1b-8b1e-4542f511f503” ] --header ‘Content-Type: application/json’ http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments

Yes, because you haven't done as I told you in my mail. You need to remove the spaces after the colons.

": " will make the yaml parser fail.

now here is the error I am getting; anyother ideas
The error appears to have been in ‘/etc/ansible/playbooks/deployment.yml’: line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  • local_action: curl --basic -u admin:admin -d ‘“name:ms3-test-app” , “servers:local$d50bdc24-ff04-4327-9284-7bb708e21c25” , “applications:local$6444f208-f78c-4e1b-8b1e-4542f511f503”’ --header ‘Content-Type:application/json’ “http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments
    ^ here
    We could be wrong, but this one looks like it might be an issue with
    unbalanced quotes. If starting a value with a quote, make sure the
    line ends with the same set of quotes. For instance this arbitrary
    example:

foo: “bad” “wolf”

Could be written as:

foo: ‘“bad” “wolf”’

It should have worked I guess.
But if you replace local_action with command and add delegate_to, it will work

- command: curl............
   delegate_to: localhost

OOI - why aren’t you using http://docs.ansible.com/ansible/uri_module.html ? maybe I missed that … maybe have a look see if that will solve the curl’ing issues ?

Alex

thanks it works. but what I was expecting the curl command response to be something like that:

{

“clusterIds”: ,

“href”: “http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments/local$41d39485-d193-4d4b-ae59-1440d2b5c858”,

“reconciled”: false,

“clusterNames”: ,

“applications”: [“local$43d12cfd-f64a-4fa9-9367-3a0109c1721d”],

“servers”: [“local$d50bdc24-ff04-4327-9284-7bb708e21c25”],

“lastModified”: “Fri, 29 Jul 2016 15:22:41.680 UTC”,

“status”: “UNDEPLOYED”,

“name”: “ms3-simple-hello-world-app”,

“id”: “local$41d39485-d193-4d4b-ae59-1440d2b5c858”

}

but the response that I am having is this one :
ok: [ip-172-31-61-191.ec2.internal] => {
“deployment”: {
“changed”: true,
“cmd”: [
“curl”,
“–basic”,
“-u”,
“admin:admin”,
“-d”,
“{"name:ms3-test-app" "servers:[local$d50bdc24-ff04-4327-9284-7bb708e21c25"] "applications:[local$88853b6a-0894-4afc-be83-6f76d2e9d9bb"]}”,
“–header”,
“Content-Type:application/json”,
http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments
],
“delta”: “0:00:00.015622”,
“end”: “2016-07-31 18:13:11.427146”,
“rc”: 0,
“start”: “2016-07-31 18:13:11.411524”,
“stderr”: " % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0\r100 11731 0 11595 100 136 974k 11708 --:–:-- --:–:-- --:–:-- 1029k",

That’s not what i was expecting I don’t why but when I run that curl command manually it works fine :
[ec2-user@ip-172-31-21-77 playbooks]$ curl --basic -u admin:admin -d ‘{“name”:“ms3-simple-hello-world-app” , “servers”: [ “local$d50bdc24-ff04-4327-9284-7bb708e21c25” ], “applications”: [ “local$43d12cfd-f64a-4fa9-9367-3a0109c1721d” ]}’ --header ‘Content-Type: application/json’ http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments
A deployment with that name already exists chose another name please or remove existing one[ec2-user@ip-172-31-21-77 playbooks]$

"local$41d39485-d193-4d4b-ae59-1440d2b5c858"}*but the response that I am
having is this one :
ok: [ip-172-31-61-191.ec2.internal] => {
    "deployment": {
        "changed": true,
        "cmd": [
            "curl",
            "--basic",
            "-u",
            "admin:admin",
            "-d",
            "{\"name:ms3-test-app\"
\"servers:[local$d50bdc24-ff04-4327-9284-7bb708e21c25\"]
\"applications:[local$88853b6a-0894-4afc-be83-6f76d2e9d9bb\"]}",
            "--header",
            "Content-Type:application/json",
            "http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments"
        ],
        "delta": "0:00:00.015622",
        "end": "2016-07-31 18:13:11.427146",
        "rc": 0,
        "start": "2016-07-31 18:13:11.411524",
        "stderr": " % Total % Received % Xferd Average Speed Time
Time Time Current\n Dload Upload
Total Spent Left Speed\n\r 0 0 0 0 0 0 0
0 --:--:-- --:--:-- --:--:-- 0\r100 11731 0 11595 100 136 974k
11708 --:--:-- --:--:-- --:--:-- 1029k",

You have not pasted everything, in stdout you will find the output of curl.

That's not what i was expecting I don't why but when I run that curl
command manually it works fine :
[ec2-user@ip-172-31-21-77 playbooks]$ curl --basic -u admin:admin -d
'{"name":"ms3-simple-hello-world-app" , "servers": [
"local$d50bdc24-ff04-4327-9284-7bb708e21c25" ], "applications": [
"local$43d12cfd-f64a-4fa9-9367-3a0109c1721d" ]}' --header 'Content-Type:
application/json' http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments

>

A deployment with that name already exists chose another name please or
remove existing one[ec2-user@ip-172-31-21-77 playbooks]$

This output you'll find in the stdout.

Here is the full response
“deployment.stdout”: “Apache Tomcat/8.0.26 - Error report<style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}

HTTP Status 500 - org.codehaus.jackson.JsonParseException: Unexpected character (‘"’ (code 34)): was expecting a colon to separate field name and value

<div class="line">

type Exception report

message org.codehaus.jackson.JsonParseException: Unexpected character (‘"’ (code 34)): was expecting a colon to separate field name and value

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: org.codehaus.jackson.JsonParseException: Unexpected character (‘"’ (code 34)): was expecting a colon to separate field name and value\n at [Source: org.apache.catalina.connector.CoyoteInputStream@89b14a5; line: 1, column: 23]\n\tcom.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:403)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:729)\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\n\torg.mule.galaxy.web.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:27)\n\torg.mule.galaxy.web.ContextPathSaverFilter.doFilter(ContextPathSaverFilter.java:48)\n\torg.springmodules.jcr.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:93)\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tcom.mulesoft.common.remoting.RemoteContextSetupFilter.doFilter(RemoteContextSetupFilter.java:51)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:181)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)\n\torg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)\n\torg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)\n

root cause

org.codehaus.jackson.JsonParseException: Unexpected character (‘"’ (code 34)): was expecting a colon to separate field name and value\n at [Source: org.apache.catalina.connector.CoyoteInputStream@89b14a5; line: 1, column: 23]\n\torg.codehaus.jackson.impl.JsonParserBase._constructError(JsonParserBase.java:651)\n\torg.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:635)\n\torg.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:576)\n\torg.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:132)\n\torg.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:346)\n\torg.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:299)\n\torg.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:983)\n\torg.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:526)\n\torg.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:213)\n\tcom.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:444)\n\tcom.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:137)\n\tcom.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)\n\tcom.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:123)\n\tcom.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:170)\n\tcom.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)\n\tcom.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:265)\n\tcom.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)\n\tcom.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)\n\tcom.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)\n\tcom.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:996)\n\tcom.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:947)\n\tcom.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:938)\n\tcom.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:399)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:729)\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\n\torg.mule.galaxy.web.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:27)\n\torg.mule.galaxy.web.ContextPathSaverFilter.doFilter(ContextPathSaverFilter.java:48)\n\torg.springmodules.jcr.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:93)\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tcom.mulesoft.common.remoting.RemoteContextSetupFilter.doFilter(RemoteContextSetupFilter.java:51)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:181)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)\n\torg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)\n\torg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)\n

note The full stack trace of the root cause is available in the Apache Tomcat/8.0.26 logs.

<hr class="line">

Apache Tomcat/8.0.26

Here is the full response
"deployment.stdout": "<!DOCTYPE html><html><head><title>Apache
Tomcat/8.0.26 - Error report</title><style type=\"text/css\">H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}.line {height: 1px;
background-color: #525D76; border: none;}</style> </head><body><h1>HTTP
Status 500 - org.codehaus.jackson.JsonParseException: Unexpected character
('&quot;' (code 34)): was expecting a colon to separate field name and
value</h1><div class=\"line\"></div><p><b>type</b> Exception
report</p><p><b>message</b> <u>org.codehaus.jackson.JsonParseException:
Unexpected character ('&quot;' (code 34)): was expecting a colon to
separate field name and value</u></p><p><b>description</b> <u>The server
encountered an internal error that prevented it from fulfilling this
request.</u></p><p><b>exception</b></p><pre>javax.servlet.ServletException:
org.codehaus.jackson.JsonParseException: Unexpected character ('&quot;'
(code 34)): was expecting a colon to separate field name and value\n at
[Source: org.apache.catalina.connector.CoyoteInputStream@89b14a5; line: 1,
column:
23]\n\tcom.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:403)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:729)\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\n\torg.mule.galaxy.web.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:27)\n\torg.mule.galaxy.web.ContextPathSaverFilter.doFilter(ContextPathSaverFilter.java:48)\n\torg.springmodules.jcr.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:93)\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tcom.mulesoft.common.remoting.RemoteContextSetupFilter.doFilter(RemoteContextSetupFilter.java:51)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:181)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)\n\torg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)\n\torg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)\n</pre><p><b>root
cause</b></p><pre>org.codehaus.jackson.JsonParseException: Unexpected
character ('&quot;' (code 34)): was expecting a colon to separate field
name and value\n at [Source:
org.apache.catalina.connector.CoyoteInputStream@89b14a5; line: 1, column:
23]\n\torg.codehaus.jackson.impl.JsonParserBase._constructError(JsonParserBase.java:651)\n\torg.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:635)\n\torg.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:576)\n\torg.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:132)\n\torg.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:346)\n\torg.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:299)\n\torg.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:983)\n\torg.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:526)\n\torg.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:213)\n\tcom.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:444)\n\tcom.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:137)\n\tcom.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)\n\tcom.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:123)\n\tcom.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:170)\n\tcom.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)\n\tcom.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:265)\n\tcom.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)\n\tcom.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)\n\tcom.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)\n\tcom.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:996)\n\tcom.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:947)\n\tcom.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:938)\n\tcom.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:399)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)\n\tcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:729)\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\n\torg.mule.galaxy.web.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:27)\n\torg.mule.galaxy.web.ContextPathSaverFilter.doFilter(ContextPathSaverFilter.java:48)\n\torg.springmodules.jcr.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:93)\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tcom.mulesoft.common.remoting.RemoteContextSetupFilter.doFilter(RemoteContextSetupFilter.java:51)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)\n\torg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:181)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)\n\torg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)\n\torg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)\n\torg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)\n\torg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)\n</pre><p><b>note</b>
<u>The full stack trace of the root cause is available in the Apache
Tomcat/8.0.26 logs.</u></p><hr class=\"line\"><h3>Apache
Tomcat/8.0.26</h3></body></html>"

Now, you have done someting to you curl line, because this is nothing like what you posted last time.

"local$41d39485-d193-4d4b-ae59-1440d2b5c858"}*but the response that I am
having is this one :
ok: [ip-172-31-61-191.ec2.internal] => {
    "deployment": {
        "changed": true,
        "cmd": [
            "curl",
            "--basic",
            "-u",
            "admin:admin",
            "-d",
            "{\"name:ms3-test-app\"
\"servers:[local$d50bdc24-ff04-4327-9284-7bb708e21c25\"]
\"applications:[local$88853b6a-0894-4afc-be83-6f76d2e9d9bb\"]}",
            "--header",
            "Content-Type:application/json",
            "http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments&quot;

        ],
        "delta": "0:00:00.015622",
        "end": "2016-07-31 18:13:11.427146",
        "rc": 0,
        "start": "2016-07-31 18:13:11.411524",
        "stderr": " % Total % Received % Xferd Average Speed Time

This is what you postet last time, the only thing you are missing here is a few lines.

I made a little test:
- command: curl --basic -u admin:admin -d '{"name":"ms3-simple-hello-world-app" , "servers":[ "local$d50bdc24-ff04-4327-9284-7bb708e21c25" ], "applications":[ "local$43d12cfd-f64a-4fa9-9367-3a0109c1721d" ]}' --header 'Content-Type:application/json'
http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments
    register: result

   TASK [debug]

Hi,

Without trying to sound too direct (or even rude), have you read the message returned at all or are you relying on the people here doing that for you?

Tomcat returned:
HTTP Status 500 - org.codehaus.jackson.JsonParseException: Unexpected character (‘"’ (code 34)): was expecting a colon to separate field name and value<div class="line">

type Exception report

message org.codehaus.jackson.JsonParseException: Unexpected character (‘"’ (code 34)): was expecting a colon to separate field name and value

I’ll be muting this thread now as it’s not got much to do with Ansible, but with basic troubleshooting of your own application.

Hope it helps though!

Thanks, it works but failed running I used the status code 302 but I got the response how can I skip the failure?

Are you using the uri module mentioned previously? if the failure is an ansible task error, you can use the ignore_errors statement in your task

  • name: get url
    uri:
    …snip…
    ignore_errors: true

thanks done