2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-14 09:14:04 +00:00

compatibility with bench setup and install cmds

This commit is contained in:
Ameya Shenoy 2018-03-03 12:46:05 +05:30
parent ebda0be772
commit a9a327cff9
No known key found for this signature in database
GPG Key ID: 735490161CD5C91E
4 changed files with 16 additions and 17 deletions

View File

@ -10,7 +10,6 @@ def install():
@click.command('prerequisites')
def install_prerequisites():
"Install prerequisites"
run_playbook('site.yml', tag='common, redis')
@click.command('mariadb')
@ -19,31 +18,31 @@ def install_maridb(mysql_root_password=''):
if mysql_root_password:
extra_vars.update({"mysql_root_password": mysql_root_password})
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='mariadb')
run_playbook('site.yml', extra_vars=extra_vars, tag='mariadb')
@click.command('wkhtmltopdf')
def install_wkhtmltopdf():
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='wkhtmltopdf')
run_playbook('site.yml', extra_vars=extra_vars, tag='wkhtmltopdf')
@click.command('nodejs')
def install_nodejs():
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='nodejs')
run_playbook('site.yml', extra_vars=extra_vars, tag='nodejs')
@click.command('psutil')
def install_psutil():
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='psutil')
run_playbook('site.yml', extra_vars=extra_vars, tag='psutil')
@click.command('supervisor')
@click.option('--user')
def install_supervisor(user=None):
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='supervisor')
run_playbook('site.yml', extra_vars=extra_vars, tag='supervisor')
if user:
setup_sudoers(user)
@click.command('nginx')
@click.option('--user')
def install_nginx(user=None):
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='nginx')
run_playbook('site.yml', extra_vars=extra_vars, tag='nginx')
if user:
setup_sudoers(user)
@ -53,7 +52,7 @@ def install_nginx(user=None):
@click.option('--findtime', default=600, help='Duration (in seconds) for IP to be banned for. Negative number for "permanent" ban.')
def install_failtoban(**kwargs):
extra_vars.update(kwargs)
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='fail2ban')
run_playbook('site.yml', extra_vars=extra_vars, tag='fail2ban')
install.add_command(install_prerequisites)
install.add_command(install_maridb)

View File

@ -89,7 +89,7 @@ def setup_firewall(ssh_port=None, force=False):
if not ssh_port:
ssh_port = 22
run_playbook('production/setup_firewall.yml', {"ssh_port": ssh_port})
run_playbook('roles/bench/tasks/setup_firewall.yml', {"ssh_port": ssh_port})
@click.command('ssh-port')
@click.argument('port')
@ -103,7 +103,7 @@ def set_ssh_port(port, force=False):
'Do you want to continue?'.format(port),
abort=True)
run_playbook('production/change_ssh_port.yml', {"ssh_port": port})
run_playbook('roles/bench/tasks/change_ssh_port.yml', {"ssh_port": port})
@click.command('lets-encrypt')
@click.argument('site')
@ -214,9 +214,9 @@ def setup_roles(role, **kwargs):
extra_vars.update(kwargs)
if role:
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag=role)
run_playbook('site.yml', extra_vars=extra_vars, tag=role)
else:
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars)
run_playbook('site.yml', extra_vars=extra_vars)
@click.command('fail2ban')
@click.option('--maxretry', default=6, help="Number of matches (i.e. value of the counter) which triggers ban action on the IP. Default is 6 seconds" )
@ -224,7 +224,7 @@ def setup_roles(role, **kwargs):
@click.option('--findtime', default=600, help='Duration (in seconds) for IP to be banned for. Negative number for "permanent" ban. Default is 600 seconds')
def setup_nginx_proxy_jail(**kwargs):
from bench.utils import run_playbook
run_playbook('prerequisites/setup_nginx_proxy_jail.yml', extra_vars=kwargs)
run_playbook('roles/fail2ban/tasks/configure_nginx_jail.yml', extra_vars=kwargs)
setup.add_command(setup_sudoers)
setup.add_command(setup_nginx)

View File

@ -22,9 +22,9 @@
- wkhtmltopdf
- name: configure mariadb
include: ../prerequisites/roles/mariadb/tasks/main.yml
include: roles/mariadb/tasks/main.yml
vars:
mysql_conf_tpl: ../prerequisites/files/mariadb_config.cnf
mysql_conf_tpl: roles/mariadb/files/mariadb_config.cnf
- name: Install MySQLdb in global env
pip: name=mysql-python version=1.2.5

View File

@ -23,9 +23,9 @@
- wkhtmltopdf
- name: configure mariadb
include_tasks: ../prerequisites/roles/mariadb/tasks/main.yml
include_tasks: roles/mariadb/tasks/main.yml
vars:
mysql_conf_tpl: ../prerequisites/files/mariadb_config.cnf
mysql_conf_tpl: roles/mariadb/files/mariadb_config.cnf
# setup frappe-bench
- include_tasks: includes/setup_bench.yml