Ansible-playbook: returned non-zero exit status 2

My Server:
Blank Debian 9.8 with python 2.7 and python 3.5

Error:
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=frappe']' returned non-zero exit status 2

Can anybody please help me?

Can you say what command(s) led to the receipt of the error? If it is from an install script, where the script originated.

Pull out the actual command and run it outside of the script to see w

ansible-playbook -c local site.yml -vvvv -e @/tmp/extra_vars.json –become –become-user=frappe

‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’,
‘–become-user=frappe’]’ returned non-zero exit status 2`

Hi @crafter,
thank you for your response.

When i run

i become:

ansible-playbook 2.8.5
  config file = None
  configured module search path = ['/home/frappe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]
No config file found; using defaults
ERROR! the playbook: site.yml could not be found

I could fix it!

see:

1 Like

Not at all sure that I follow. The error:

ERROR! the playbook: site.yml could not be found

was this ever resolved? How?

Is there any solution to this error? I too facing the same issue.

hi,
I am running this for the first time and i am getting the same error. kindly share how you cloned to fix the issue.

Hi @joelios
Agree with @Bungei please share your method of cloning, cuz I have cloned the GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps and replaced the /home/frapper/.bench with the cloned one and ran the Install.py but still getting the same error for ansible-playbook. Please suggest and correct me if I’m doing something wrong. Thanks in advance :slight_smile:

I’m using Ubuntu 18.

ERROR:
root@ta-virtual-machine:/home/frappe/.bench# python3 /home/ta/Downloads/install.py --production
Logs are saved under /tmp/logs/easy-install__2021-11-01__06-02.log
curl already installed!
wget already installed!
git already installed!
pip3 already installed!
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.11.1 documentation
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.11.1 documentation
pip3 already installed!
Checking System Compatibility…
ubuntu 18 is compatible!
Not cloning already existing Bench repository at /tmp/.bench
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not
match ‘all’
Input MySQL and Frappe Administrator passwords:
Passwords saved at ~/passwords.txt
Initializing bench frappe-bench:
Frappe Branch: version-12
ERPNext Branch: version-12
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not
match ‘all’
[WARNING]: Consider using the get_url or uri module rather than running ‘curl’. If you need to use command because
get_url or uri is insufficient you can add ‘warn: false’ to this command task or set ‘command_warnings=False’ in
ansible.cfg to get rid of this message.
[DEPRECATION WARNING]: evaluating [] as a bare variable, this behaviour will go away and you might need to add
|bool to the expression in the future. Also see CONDITIONAL_BARE_VARS configuration toggle… This feature will be
removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Consider using the file module with owner rather than running ‘chown’. If you need to use command
because file is insufficient you can add ‘warn: false’ to this command task or set ‘command_warnings=False’ in
ansible.cfg to get rid of this message.
Traceback (most recent call last):
File “/home/ta/Downloads/install.py”, line 500, in
install_bench(args)
File “/home/ta/Downloads/install.py”, line 281, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “/home/ta/Downloads/install.py”, line 416, in run_playbook
success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)
File “/usr/lib/python3.6/subprocess.py”, line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=frappe’]’ returned non-zero exit status 2.

Hi, were you able to fix this. I am getting the same issue.