-2

Receiving an error

in atomic_move os.rename(b_src, b_dest) OSError: [Errno 0] Error

when we try to copy a package from source to destination. This is happening across many nodes while we are trying to deploy the packages via Ansible Tower.

Part of the code is as below:

- name:  Copying war file to deployment hosts
  copy:
    src: "/data/war/{{war_file}}"
    dest: "/deployments/war/release/{{war_file}}"
    owner: user
    group: user
    mode: '0775'
  when:
    - 'ansible_hostname == dep_host_list'
  loop: "{{deployment_hosts}}"
  loop_control:
    loop_var: dep_host_list

Complete error from Tower job is as below:

{
    "exception": "Traceback (most recent call last):\n  File \"/tmp/ansible_copy_payload_C9TqwM/ansible_copy_payload.zip/ansible/module_utils/basic.py\", line 2251, in atomic_move\n    os.rename(b_src, b_dest)\nOSError: [Errno 0] Error\n",
    "ansible_loop_var": "dep_host_list",
    "_ansible_item_label": "host",
    "checksum": "e55681eb4d74383e5b10121729f",
    "dep_host_list": "host",
    "msg": "Could not replace file: /home/user/.ansible/tmp/ansible-tmp-1677744165.38-29519-145869181884410/source to /deployments/war/release/war-1.0.war: [Errno 0] Error",
    "changed": false,
    "invocation": {
        "module_args": {
            "directory_mode": null,
            "force": true,
            "remote_src": null,
            "dest": "/deployments/war/release/war-1.0.war",
            "selevel": null,
            "_original_basename": "war-1.0.war",
            "delimiter": null,
            "regexp": null,
            "owner": "test_user",
            "follow": false,
            "validate": null,
            "local_follow": null,
            "src": "/home/user/.ansible/tmp/ansible-tmp-1677744165.38-29519-145869181884410/source",
            "group": "test_user",
            "unsafe_writes": null,
            "checksum": "e55681eb4d74383e5b10121729f",
            "seuser": null,
            "setype": null,
            "content": null,
            "serole": null,
            "mode": "0775",
            "attributes": null,
            "backup": false
        }
    },
    "diff": [],
    "_ansible_no_log": false
}

Have anyone encountered a similar issue with deployments via Ansible Tower?

Any advise on fixing this issue would be much appreciated as we are completely stuck with Ansible Tower not allowing to copy the files between the hosts.

U880D
  • 8,601
  • 6
  • 24
  • 40
Akhil S
  • 29
  • 5
  • In respect to the given Python error `in atomic_move os.rename(b_src, b_dest) OSError: [Errno 0] Error`, can you provide more information regarding your environments and setups? In example: Ansible, Tower and OS versions, Target OS and Python versions, Containerized targets or container environment?, Are there symlinks involved? Are the access rights OK? – U880D May 23 '23 at 10:56
  • 1
    Regarding "_Have anyone encountered a similar issue_" starting points for research might be [Copy module does not cleanup temp files on failure #64408](https://github.com/ansible/ansible/issues/64408), [Difficult to use file-type modules inside of containers because of how module utils is implemented #73310](https://github.com/ansible/ansible/issues/73310) or search terms like `os.rename in Python return errno 0`. – U880D May 23 '23 at 11:09

1 Answers1

-1

It was found that VMware Carbon Black Bit9 Security Solution was blocking the job executions from Ansible. We have managed to fix it by disabling Bit9 from the server.

U880D
  • 8,601
  • 6
  • 24
  • 40
Akhil S
  • 29
  • 5
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 24 '23 at 09:06
  • "_We have managed to fix it_", no, I don't think so. I would consider this neither as a fix nor as a workaround but only as a temporary troubleshooting step. Instead of disabling the whole Security Solution on all Endpoints, wouldn't be the Setup of specific Exclusions for some tasks and operations the solution? – U880D May 26 '23 at 09:25