Ansible 'copy' module failure | 'in atomic_move os.rename(b_src, b_dest) OSError: [Errno 0] Error'

181 Views Asked by At

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.

1

There are 1 best solutions below

2
Akhil S On

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.