Rundeck can not delete unddefined jobs
Summary
When defined jobs in rundeck differ by names from existing jobs in rundeck it tries to delete those not defined jobs. Unfortunetly it fails on that task.
Steps to reproduce
Change name of one of defined jobs and run jobs playbook with projects
tag.
ansible-playbook -i environments/development/ deploy.yml --tags projects
Expected behavior
Jobs should be deployed and those which was not defined should be deleted.
Actual behavior
Playbook fails on delete not defined jobs which exist in rundeck
task.
Relevant logs and/or screenshots
fatal: [localhost]: FAILED! => {
"changed": false,
"connection": "close",
"content": "{\"error\":true,\"apiversion\":27,\"errorCode\":\"api.error.parameter.required\",\"message\":\"parameter \\\"Any of: ids, idlist\\\" is required\"}",
"content_type": "application/json;charset=utf-8",
"date": "Thu, 25 Oct 2018 08:24:55 GMT",
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": {
"ids": [
"ea780e5b-797e-4a3b-92bd-774eea61ef30"
]
},
"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",
"Cookie": "JSESSIONID=node0afpbtupv94s416s7715bvogca149.node0;Path=/;HttpOnly"
},
"http_agent": "ansible-httpget",
"method": "DELETE",
"mode": null,
"owner": null,
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
"200"
],
"timeout": 30,
"unsafe_writes": null,
"url": "https://dev.jobs.cloud.task.gda.pl/api/25/jobs/delete",
"url_password": null,
"url_username": null,
"use_proxy": true,
"validate_certs": true
}
},
"json": {
"apiversion": 27,
"error": true,
"errorCode": "api.error.parameter.required",
"message": "parameter \"Any of: ids, idlist\" is required"
},
"msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request",
"redirected": false,
"server": "nginx",
"status": 400,
"transfer_encoding": "chunked",
"url": "https://dev.jobs.cloud.task.gda.pl/api/25/jobs/delete",
"x_application_context": "application:production:4440",
"x_rundeck_api_version": "27"
}
Possible fixes
Change uri method from DELETE to POST in delete not defined jobs which exist in rundeck
task.