# "AnsiballZ\_setup.py: No such file or directory"

**URL:** <https://forum.ansible.com/t/ansiballz-setup-py-no-such-file-or-directory/7957>\
**Category:** Get Help\
**Tags:** ansible-core\
**Created:** [August 19, 2024, 7:30pm UTC](https://forum.ansible.com/t/ansiballz-setup-py-no-such-file-or-directory/7957 "2024-08-19T19:30:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggordon-salucro](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ggordon-salucro/32/4147_2.png) [@ggordon-salucro](https://forum.ansible.com/u/ggordon-salucro)\
**Post date:** [August 19, 2024, 7:30pm UTC](https://forum.ansible.com/t/ansiballz-setup-py-no-such-file-or-directory/7957/1 "2024-08-19T19:30:15Z")

</div>

Hey there!

I’m upgrading my build agents from Amazon Linux 2 to Amazon Linux 2023. This includes an upgrade from ansible 2.9.23/python 2.7.18 (!!) to ansible 2.15.3/python 3.9.16.

I’m getting an error when running the new version of Ansible - it’s failing during the Gathering Facts stage. Here’s a link to the cleaned-up logs with `ANSIBLE_VERBOSITY=4`: [ansible.log · GitHub](https://gist.github.com/ggordon-salucro/c70ebde584adc2058cfe52202a636b47)

It seems like this is the relevant error:

```auto
	debug1: Couldn't stat remote file: No such file or directory
	debug3: source_sftp: copying local /home/ec2-user/.ansible/tmp/ansible-local-33222mc2zdwp/tmp0asestpp to remote '~ec2-user/.ansible/tmp/ansible-tmp-1724093332.1204538-3326-37864137221757/AnsiballZ_setup.py'
	debug3: Sent dest message SSH2_FXP_OPEN I:2 P:'~ec2-user/.ansible/tmp/ansible-tmp-1724093332.1204538-3326-37864137221757/AnsiballZ_setup.py' M:0x001a
	dest open(\"'~ec2-user/.ansible/tmp/ansible-tmp-1724093332.1204538-3326-37864137221757/AnsiballZ_setup.py'\"): No such file or directory
	failed to upload file /home/ec2-user/.ansible/tmp/ansible-local-33222mc2zdwp/tmp0asestpp to '~ec2-user/.ansible/tmp/ansible-tmp-1724093332.1204538-3326-37864137221757/AnsiballZ_setup.py'
	debug3: mux_client_read_packet: read header failed: Broken pipe
	debug2: Control master terminated unexpectedly

```

It seems like Ansible isn’t able to copy AnsiballZ\_setup.py to the target. From what I can tell, we are able to authenticate to the target, though:

```auto
	debug1: Sending command: /bin/sh -c \'echo ~ec2-user && sleep 0\'
        [...]
	debug2: set_control_persist_exit_time: schedule exit in 60 seconds
	debug2: Received exit status from master 0

```

But, for some reason, Ansible can’t copy the file over.

I know it complicates the question, but if it’s at all relevant - this is a Jenkins build agent, running Packer’s “ansible” provisioner, against an Amazon EC2 instance.

I’d appreciate any help with next steps on troubleshooting the issue! Happy to share further details of my infrastructure if needed.
