Trying to delete a running app on Marathon by Ansible Playbook - Error

Hi,

I deployed an app on Marathon with POST using uri module. My inventory file has just localhost which I am using to execute my playbooks.

I have written a playbook to delete that app, it will successfully delete the app, but the only problem which I am facing is that I am getting below error with successful response code.

fatal: [localhost]: FAILED! => {“cache_control”: “no-cache, no-store, must-revalidate”, “changed”: false, “connection”: “close”, “content”: “{"version":"2016-10-12T15:51:51.738Z","deploymentId":"f200ffd5-095f-4dd5-865b-4958f0d0adfc"}”, “content_length”: “92”, “content_type”: “application/json; qs=2”, “date”: “Wed, 12 Oct 2016 15:51:06 GMT”, “expires”: “0”, “failed”: true, “json”: {“deploymentId”: “f200ffd5-095f-4dd5-865b-4958f0d0adfc”, “version”: “2016-10-12T15:51:51.738Z”}, “msg”: “Status code was not [201]: OK (92 bytes)”, “pragma”: “no-cache”, “redirected”: false, “server”: “openresty/1.7.10.2”, “status”: 200, “url”: “http://jmontesvm07.verizon.com:19092/v2/apps/demoansible”, “x_marathon_leader”: “http://10.200.161.1:31392”}

I am concerned about the highlighted error and I want to get rid of it.

The json response gives successful response with status 200. Can anyone help me with how to solve the highlighted error.

Thanks in advance.

-Yogesh Darji

Set a status_code: field to the value marathon returns, it looks like
you are getting a 200 and ansible is expecting a 201.