Error on Install sudo bench setup production

$ bench setup role nginx
ansible-playbook [core 2.15.0]
config file = None
configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.10.12 (main, Jun 7 2023, 12:45:35) [GCC 9.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = False
No config file found; using defaults
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
[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’
[DEPRECATION WARNING]: “include” is deprecated, use include_tasks/import_tasks instead. See
https://docs.ansible.com/ansible-core/2.15/user_guide/playbooks_reuse_includes.html for details. This feature will be
removed in version 2.16. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
statically imported: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/centos.yml
statically imported: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml
statically imported: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml
redirecting (type: modules) ansible.builtin.homebrew to community.general.homebrew
Loading collection community.general from /usr/local/lib/python3.10/dist-packages/ansible_collections/community/general
redirecting (type: modules) ansible.builtin.selinux to ansible.posix.selinux
Loading collection ansible.posix from /usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/posix
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.10/dist-packages/ansible/plugins/callback/default.py
Skipping callback ‘default’, as we already have a stdout callback.
Skipping callback ‘minimal’, as we already have a stdout callback.
Skipping callback ‘oneline’, as we already have a stdout callback.

PLAYBOOK: site.yml *****************************************************************************************************
Positional arguments: site.yml
verbosity: 4
connection: local
timeout: 10
become_method: sudo
tags: (‘nginx’,)
inventory: (‘/etc/ansible/hosts’,)
extra_vars: (‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’,)
forks: 5
2 plays in site.yml

PLAY [localhost] *******************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/site.yml:4
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c ‘echo ~root && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /root/.ansible/tmp”&& mkdir “echo /root/.ansible/tmp/ansible-tmp-1692347673.6426423-777646-246859680004207” && echo ansible-tmp-1692347673.6426423-777646-246859680004207=“echo /root/.ansible/tmp/ansible-tmp-1692347673.6426423-777646-246859680004207” ) && sleep 0’
Using module file /usr/local/lib/python3.10/dist-packages/ansible/modules/setup.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-777639puf_cvex/tmp3p3cdn4i TO /root/.ansible/tmp/ansible-tmp-1692347673.6426423-777646-246859680004207/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1692347673.6426423-777646-246859680004207/ /root/.ansible/tmp/ansible-tmp-1692347673.6426423-777646-246859680004207/AnsiballZ_setup.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1692347673.6426423-777646-246859680004207/AnsiballZ_setup.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1692347673.6426423-777646-246859680004207/ > /dev/null 2>&1 && sleep 0’
ok: [localhost]

TASK [nginx : Include OS-specific variables.] **************************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/main.yml:3
ok: [localhost] => {
“ansible_facts”: {
“__nginx_user”: “www-data”,
“nginx_default_vhost_path”: “/etc/nginx/sites-enabled/default”,
“nginx_vhost_path”: “/etc/nginx/sites-enabled”
},
“ansible_included_var_files”: [
“/usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/vars/Debian.yml”
],
“changed”: false
}

TASK [nginx : Define nginx_user.] **************************************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/main.yml:6
ok: [localhost] => {
“ansible_facts”: {
“nginx_user”: “www-data”
},
“changed”: false
}

TASK [nginx : include_tasks] *******************************************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/main.yml:12
skipping: [localhost] => {
“changed”: false,
“false_condition”: “ansible_os_family == ‘RedHat’”,
“skip_reason”: “Conditional result was False”
}

TASK [nginx : include_tasks] *******************************************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/main.yml:15
included: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/setup-Debian.yml for localhost

TASK [nginx : Add nginx apt repository key for Debian < 8] *************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/setup-Debian.yml:2
skipping: [localhost] => {
“changed”: false,
“false_condition”: “ansible_distribution == ‘Debian’ and ansible_distribution_version is version_compare(‘8’, ‘lt’)”,
“skip_reason”: “Conditional result was False”
}

TASK [nginx : Add nginx apt repository for Debian < 8] *****************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/setup-Debian.yml:8
skipping: [localhost] => {
“changed”: false,
“false_condition”: “ansible_distribution == ‘Debian’ and ansible_distribution_version is version_compare(‘8’, ‘lt’)”,
“skip_reason”: “Conditional result was False”
}

TASK [nginx : Ensure nginx is installed.] ******************************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/nginx/tasks/setup-Debian.yml:14
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c ‘echo ~root && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /root/.ansible/tmp”&& mkdir “echo /root/.ansible/tmp/ansible-tmp-1692347675.1503153-777714-280059862158864” && echo ansible-tmp-1692347675.1503153-777714-280059862158864=“echo /root/.ansible/tmp/ansible-tmp-1692347675.1503153-777714-280059862158864” ) && sleep 0’
Using module file /usr/local/lib/python3.10/dist-packages/ansible/modules/apt.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-777639puf_cvex/tmpp8hd9yyh TO /root/.ansible/tmp/ansible-tmp-1692347675.1503153-777714-280059862158864/AnsiballZ_apt.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1692347675.1503153-777714-280059862158864/ /root/.ansible/tmp/ansible-tmp-1692347675.1503153-777714-280059862158864/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1692347675.1503153-777714-280059862158864/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1692347675.1503153-777714-280059862158864/ > /dev/null 2>&1 && sleep 0’
[WARNING]: Updating cache and auto-installing missing dependency: python3-apt
fatal: [localhost]: FAILED! => {
“changed”: false,
“cmd”: “apt-get update”,
“invocation”: {
“module_args”: {
“allow_change_held_packages”: false,
“allow_downgrade”: false,
“allow_unauthenticated”: false,
“autoclean”: false,
“autoremove”: false,
“cache_valid_time”: 0,
“clean”: false,
“deb”: null,
“default_release”: “”,
“dpkg_options”: “force-confdef,force-confold”,
“fail_on_autoremove”: false,
“force”: false,
“force_apt_get”: false,
“install_recommends”: null,
“lock_timeout”: 60,
“only_upgrade”: false,
“package”: [
“nginx”
],
“pkg”: “nginx”,
“policy_rc_d”: null,
“purge”: false,
“state”: “present”,
“update_cache”: null,
“update_cache_retries”: 5,
“update_cache_retry_max_delay”: 12,
“upgrade”: “no”
}
},
“msg”: “Traceback (most recent call last):\n File "/usr/lib/cnf-update-db", line 8, in \n from CommandNotFound.db.creator import DbCreator\n File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in \n import apt_pkg\nModuleNotFoundError: No module named ‘apt_pkg’\nE: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi’\nE: Sub-process returned an error code”,
“rc”: 100,
“stderr”: “Traceback (most recent call last):\n File "/usr/lib/cnf-update-db", line 8, in \n from CommandNotFound.db.creator import DbCreator\n File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in \n import apt_pkg\nModuleNotFoundError: No module named ‘apt_pkg’\nE: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi’\nE: Sub-process returned an error code\n”,
“stderr_lines”: [
“Traceback (most recent call last):”,
" File "/usr/lib/cnf-update-db", line 8, in “,
" from CommandNotFound.db.creator import DbCreator”,
" File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in “,
" import apt_pkg”,
“ModuleNotFoundError: No module named ‘apt_pkg’”,
“E: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi’”,
“E: Sub-process returned an error code”
],
“stdout”: “Hit:1 http://asi-fs-d.contabo.net/ubuntu focal InRelease\nHit:2 http://asi-fs-d.contabo.net/ubuntu focal-updates InRelease\nHit:3 http://asi-fs-d.contabo.net/ubuntu focal-backports InRelease\nHit:4 http://security.ubuntu.com/ubuntu focal-security InRelease\nHit:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease\nReading package lists…\n”,
“stdout_lines”: [
“Hit:1 http://asi-fs-d.contabo.net/ubuntu focal InRelease”,
“Hit:2 http://asi-fs-d.contabo.net/ubuntu focal-updates InRelease”,
“Hit:3 http://asi-fs-d.contabo.net/ubuntu focal-backports InRelease”,
“Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease”,
“Hit:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease”,
“Reading package lists…”
]
}

PLAY RECAP *************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=1 skipped=3 rescued=0 ignored=0

ERROR: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘nginx’]’ returned non-zero exit status 2.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 127, in cli
bench_command()
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1130, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1055, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 760, in invoke
return __callback(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 368, in setup_roles
run_playbook(“site.yml”, extra_vars=extra_vars, tag=role)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 325, in run_playbook
subprocess.check_call(args, cwd=os.path.join(bench.path[0], “playbooks”))
File “/usr/lib/python3.10/subprocess.py”, line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘nginx’]’ returned non-zero exit status 2.
INFO: A newer version of bench is available: 5.16.2 → 5.17.0
ERROR:
subprocess.CalledProcessError: Command ‘bench setup role nginx’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 127, in cli
bench_command()
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1130, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1055, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 760, in invoke
return __callback(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 108, in setup_production
setup_production(user=user, yes=yes)
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 37, in setup_production
setup_production_prerequisites()
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 30, in setup_production_prerequisites
exec_cmd(“bench setup role nginx”)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 158, in exec_cmd
raise CommandFailedError from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError
INFO: A newer version of bench is available: 5.16.2 → 5.17.0