Error when run "sudo bench setup production frappe" for set to production mode

Hi everybody.

When I try to setup in production mode my instance of ERPNext I get this error:

INFO:bench.utils:bench setup role fail2ban
 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in '/home/frappe/bench-repo/playbooks/roles/common/tasks/main.yml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- include_tasks: debian_family.yml
  ^ here

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/setup.py", line 246, in setup_roles
    run_playbook('site.yml', extra_vars=extra_vars, tag=role)
  File "/home/frappe/bench-repo/bench/utils.py", line 815, in run_playbook
    subprocess.check_call(args, cwd=os.path.join(os.path.dirname(bench.__path__[0]), 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '{"mysql_root_password": null, "production": true, "admin_emails": ""}', '-t', u'fail2ban']' returned non-zero exit status 4
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/setup.py", line 59, in setup_production
    exec_cmd("bench setup role fail2ban")
  File "/home/frappe/bench-repo/bench/utils.py", line 152, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: bench setup role fail2ban

OS: Ubuntu 16.04.4

Installed version:

  • erpnext 10.1.20
  • frappe 10.1.21

I hope anyone can help with the problem.

Thanks

2 Likes

Try bringing bench to the latest version, and check again.

I’m unable to replicate the issue. Can you give a few more details, anything which might help. Also try executing bench setup role fail2ban and see if it works.

Hi @codingCoffee

I did this in a fresh installation of Ubuntu:

[1]

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

I tried executing “sudo bench setup role fail2ban” and I get this error:

sudo bench setup role fail2ban
[sudo] password for frappe: 
 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in '/home/frappe/bench-repo/playbooks/roles/common/tasks/main.yml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- include_tasks: debian_family.yml
  ^ here


The error appears to have been in '/home/frappe/bench-repo/playbooks/roles/common/tasks/main.yml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- include_tasks: debian_family.yml
  ^ here

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/setup.py", line 246, in setup_roles
    run_playbook('site.yml', extra_vars=extra_vars, tag=role)
  File "/home/frappe/bench-repo/bench/utils.py", line 815, in run_playbook
    subprocess.check_call(args, cwd=os.path.join(os.path.dirname(bench.__path__[0]), 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '{"mysql_root_password": null, "production": true, "admin_emails": ""}', '-t', u'fail2ban']' returned non-zero exit status 4

Thanks

1 Like

I forgot to say, I don’t have fail2ban installed. :slight_smile:

Thanks

I did “bench update” and I get same error when tryin to set to production mode.

Thanks

Just a thought but try doing a simple

sudo apt-get install fail2ban before executing the script.

1 Like

Hi @Julian_Robbins

I don’t want to install it because of this: Intermittent disconnection issue - #2 by max_morais_dmm

Thanks

Personally I would always install fail2ban on an internet facing site. And in the post there is a means shown on how to whitelist your own users.

I’ve run fail2ban on my servers without issues for a number of years but i understand your reticence …

I had the same problem.
Was solved by update ansible to the last a version >= 2.4.0.0.

5 Likes

This solved my problem.

Thanks @gpreviato