I’m trying to unarchive
a file on my local machine, which was obtained from the remote server via the synchronize
module.
# sample.yml
- name: Create MySQL dump from remote server
hosts: mysql_servers
become: yes
tasks:
- name: Unzip the MySQL dump
delegate_to: localhost
unarchive:
src: "/home/jpg/ansible-test-dir/sample.zip"
dest: "/home/jpg/ansible-test-dir/out-dir/"
I’m sure that the src
and dest
values are present on my machine, but, got the following traceback
TASK [Unzip the MySQL dump] **********************************************************************************************************************************************************************************************************************************
task path: /home/jpg/work-dir/projects/-personal/ansible-workspace/ottu/mysql_dump.yml:5
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: jpg
<localhost> EXEC /bin/sh -c 'echo ~jpg && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/jpg/.ansible/tmp `"&& mkdir "` echo /home/jpg/.ansible/tmp/ansible-tmp-1721670452.2483582-195992-128492760297455 `" && echo ansible-tmp-1721670452.2483582-195992-128492760297455="` echo /home/jpg/.ansible/tmp/ansible-tmp-1721670452.2483582-195992-128492760297455 `" ) && sleep 0'
Using module file /home/jpg/.local/share/virtualenvs/ansible-workspace-ndVlfad5/lib/python3.10/site-packages/ansible/modules/stat.py
<localhost> PUT /home/jpg/.ansible/tmp/ansible-local-19594223tg0ll7/tmpmv5v8kw7 TO /home/jpg/.ansible/tmp/ansible-tmp-1721670452.2483582-195992-128492760297455/AnsiballZ_stat.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/jpg/.ansible/tmp/ansible-tmp-1721670452.2483582-195992-128492760297455/ /home/jpg/.ansible/tmp/ansible-tmp-1721670452.2483582-195992-128492760297455/AnsiballZ_stat.py && sleep 0'
<localhost> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-eyqgvpjvpushbkbbqmjggbkqwhqtxasf ; /home/jpg/.local/share/virtualenvs/ansible-workspace-ndVlfad5/bin/python /home/jpg/.ansible/tmp/ansible-tmp-1721670452.2483582-195992-128492760297455/AnsiballZ_stat.py'"'"' && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/jpg/.ansible/tmp/ansible-tmp-1721670452.2483582-195992-128492760297455/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/home/jpg/.local/share/virtualenvs/ansible-workspace-ndVlfad5/lib/python3.10/site-packages/ansible/plugins/action/unarchive.py", line 77, in run
remote_stat = self._execute_remote_stat(dest, all_vars=task_vars, follow=True)
File "/home/jpg/.local/share/virtualenvs/ansible-workspace-ndVlfad5/lib/python3.10/site-packages/ansible/plugins/action/__init__.py", line 864, in _execute_remote_stat
raise AnsibleError('Failed to get information on remote file (%s): %s' % (path, msg))
ansible.errors.AnsibleError: Failed to get information on remote file (/home/jpg/ansible-test-dir/out-dir/): sudo: a password is required
fatal: [hotfix.ottu.dev -> localhost]: FAILED! => {
"changed": false,
"msg": "Failed to get information on remote file (/home/jpg/ansible-test-dir/out-dir/): sudo: a password is requiredn"
}
What is causing the error? How can I fix this?