Elasticsearch fails on backup index
Summary
When running elasticsearch backup on rundeck it fails on backup index
task it's seems that docker_container
module can't be run with detach: no
and auto_remove: yes
at the same time
Steps to reproduce
Run elasticsearch backup
Expected behavior
Elasticsearch backup index should be dump
Actual behavior
Playbook fails
Relevant logs and/or screenshots
TASK [elasticsearch : backup index log-2018.09.09-mapping] *********************
13:32:49 Monday 10 September 2018 11:32:49 +0000 (0:00:00.139) 0:00:04.578 ******
13:32:51 An exception occurred during task execution. To see the full traceback, use -vvv. The error was: docker.errors.NotFound: 404 Client Error: Not Found ("No such container: e8539a4c0177f2365a9f11c044756c7f57704c8ee72b49a4facb3d9a424889bb")
13:32:51 fatal: [localhost]: FAILED! => {"changed": true, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_YGtnlf/ansible_module_docker_container.py\", line 2108, in <module>\n main()\n File \"/tmp/ansible_YGtnlf/ansible_module_docker_container.py\", line 2103, in main\n cm = ContainerManager(client)\n File \"/tmp/ansible_YGtnlf/ansible_module_docker_container.py\", line 1712, in __init__\n self.present(state)\n File \"/tmp/ansible_YGtnlf/ansible_module_docker_container.py\", line 1759, in present\n container = self.container_start(container.Id)\n File \"/tmp/ansible_YGtnlf/ansible_module_docker_container.py\", line 1918, in container_start\n output = self.client.logs(container_id, stdout=True, stderr=True, stream=False, timestamps=False)\n File \"/usr/lib/python2.7/site-packages/docker/utils/decorators.py\", line 19, in wrapped\n return f(self, resource_id, *args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/docker/api/container.py\", line 827, in logs\n output = self._get_result(container, stream, res)\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 413, in _get_result\n return self._get_result_tty(stream, res, self._check_is_tty(container))\n File \"/usr/lib/python2.7/site-packages/docker/utils/decorators.py\", line 19, in wrapped\n return f(self, resource_id, *args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 409, in _check_is_tty\n cont = self.inspect_container(container)\n File \"/usr/lib/python2.7/site-packages/docker/utils/decorators.py\", line 19, in wrapped\n return f(self, resource_id, *args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/docker/api/container.py\", line 730, in inspect_container\n self._get(self._url(\"/containers/{0}/json\", container)), True\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 235, in _result\n self._raise_for_status(response)\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 231, in _raise_for_status\n raise create_api_error_from_http_exception(e)\n File \"/usr/lib/python2.7/site-packages/docker/errors.py\", line 31, in create_api_error_from_http_exception\n raise cls(e, response=response, explanation=explanation)\ndocker.errors.NotFound: 404 Client Error: Not Found (\"No such container: e8539a4c0177f2365a9f11c044756c7f57704c8ee72b49a4facb3d9a424889bb\")\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
Possible fixes
Replace auto_remove
with cleanup
parameter to true (https://docs.ansible.com/ansible/latest/modules/docker_container_module.html#parameters)