Issue with Ansible

141 views
Skip to first unread message

GBANE FETIGUE

unread,
Jul 29, 2016, 3:19:56 PM7/29/16
to Ansible Project
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 ?

Kai Stian Olstad

unread,
Jul 29, 2016, 4:13:41 PM7/29/16
to ansible...@googlegroups.com
On 29. juli 2016 21:19, GBANE FETIGUE wrote:
> 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.

--
Kai Stian Olstad

Joanna Delaporte

unread,
Jul 29, 2016, 5:20:03 PM7/29/16
to Ansible Project
"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.

GBANE FETIGUE

unread,
Jul 31, 2016, 9:14:39 AM7/31/16
to Ansible Project
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

Kai Stian Olstad

unread,
Jul 31, 2016, 10:07:52 AM7/31/16
to ansible...@googlegroups.com
On 31. juli 2016 15:14, GBANE FETIGUE wrote:
> I still have the same issue any other ideas ?

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.

--
Kai Stian Olstad

GBANE FETIGUE

unread,
Jul 31, 2016, 11:39:04 AM7/31/16
to Ansible Project, ansible-pr...@olstad.com
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"'

Kai Stian Olstad

unread,
Jul 31, 2016, 12:21:48 PM7/31/16
to ansible...@googlegroups.com
On 31. juli 2016 17:39, GBANE FETIGUE wrote:
> *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
> maybe 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

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

--
Kai Stian Olstad

Alex Leonhardt

unread,
Jul 31, 2016, 1:21:41 PM7/31/16
to ansible...@googlegroups.com
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



--
Kai Stian Olstad

--
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.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6a66b5d1-7424-8db8-66d8-20d7c2faa9c2%40olstad.com.

For more options, visit https://groups.google.com/d/optout.

GBANE FETIGUE

unread,
Jul 31, 2016, 2:28:35 PM7/31/16
to Ansible Project, ansible-pr...@olstad.com
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]$

Kai Stian Olstad

unread,
Jul 31, 2016, 2:46:29 PM7/31/16
to ansible...@googlegroups.com
On 31. juli 2016 20:28, GBANE FETIGUE wrote:
> "local$41d39485-d193-4d4b-ae59-1440d2b5c858"}*but the response that I am
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.

--
Kai Stian Olstad

GBANE FETIGUE

unread,
Aug 1, 2016, 2:47:41 PM8/1/16
to Ansible Project, ansible-pr...@olstad.com

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>"

Kai Stian Olstad

unread,
Aug 1, 2016, 3:41:45 PM8/1/16
to ansible...@googlegroups.com
Now, you have done someting to you curl line, because this is nothing
like what you posted last time.

>> On 31. juli 2016 20:28, GBANE FETIGUE wrote:
>>> "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

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]
*******************************************************************
ok: [localhost] => {
"result": {
"changed": true,
"cmd": [
"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"
],
"delta": "0:00:00.422805",
"end": "2016-08-01 21:14:43.138400",
"rc": 0,
"start": "2016-08-01 21:14:42.715595",
"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 254 0 91
100 163 219 393 --:--:-- --:--:-- --:--:-- 394",
"stdout": "A deployment with that name already exists chose
another name please or remove existing one",
"stdout_lines": [
"A deployment with that name already exists chose another
name please or remove existing one"
],
"warnings": [
"Consider using get_url or uri module rather than running
curl"
]
}
}


Since you no longer is using curl with forms, you could as Alex mention
use the uri module also.

- uri:
url=http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments
method=POST
force_basic_auth=yes
user=admin
password=admin
body_format=json

body='{"name":"ms3-simple-hello-world-app","servers":["local$d50bdc24-ff04-4327-9284-7bb708e21c25"],"applications":["local$43d12cfd-f64a-4fa9-9367-3a0109c1721d"]}'
headers=Content-Type=application/json

The uri module will fail at the moment, but this behavior can be
controlled with "status_code".

--
Kai Stian Olstad

Alex Leonhardt

unread,
Aug 1, 2016, 4:29:28 PM8/1/16
to ansible...@googlegroups.com
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 ('&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

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!
--
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.
To post to this group, send email to ansible...@googlegroups.com.

GBANE FETIGUE

unread,
Aug 1, 2016, 8:35:26 PM8/1/16
to Ansible Project, ansible-pr...@olstad.com
Thanks, it works but failed running I used the status code 302 but I got the response how can I skip the failure?  

Stephen Granger

unread,
Aug 1, 2016, 9:17:46 PM8/1/16
to ansible...@googlegroups.com
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


--
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.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve

GBANE FETIGUE

unread,
Aug 1, 2016, 9:23:56 PM8/1/16
to Ansible Project
thanks done
Reply all
Reply to author
Forward
0 new messages