Sudo bench setup production ERROR! [DEPRECATED]: ansible.builtin.include has been removed

sidhy@ps:~/frappe-bench$ sudo bench setup production sidhy
Setting Up prerequisites…
$ bench setup role fail2ban
ansible-playbook [core 2.16.7]
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, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.1.4
libyaml = True
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’
ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.

The error appears to be in ‘/usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml’: line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  • include: centos.yml
    ^ here
    ERROR: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 1.
    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 132, in cli
    bench_command()
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1157, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1078, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 783, in invoke
    return __callback(*args, **kwargs)
    File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 370, 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 345, 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’, ‘fail2ban’]’ returned non-zero exit status 1.
    ERROR: bench setup role fail2ban
    subprocess.CalledProcessError: Command ‘bench setup role fail2ban’ 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 132, in cli
bench_command()
File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 110, 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 28, in setup_production_prerequisites
exec_cmd(“bench setup role fail2ban”)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 178, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench setup role fail2ban

sidhy@ps:~/frappe-bench$

how to fix

Hi,

Please change the three lines as marked in red circle in the below image and run the production setup again in the file '/usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml’

Thanks,

Divyesh Mangroliya

8 Likes

Thanks Bro

Hi, i am also facing this same issue. how to change this. can you please tell me!

Please update main.yml file on given path as mentioned in the screenshot, before running command.

You need to add _tasks on three lines after include.

Thanks,

Divyesh Mangroliya

Mentioned file not showing in that file

Hi,

You may have different version of python, so please check python folder according to your version.

Path is as follows:

/usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml

Thanks,

Divyesh Mangroliya