diff --git a/bench/commands/__init__.py b/bench/commands/__init__.py index 683df339..0907f12d 100755 --- a/bench/commands/__init__.py +++ b/bench/commands/__init__.py @@ -68,3 +68,6 @@ from bench.commands.git import remote_set_url, remote_reset_url, remote_urls bench_command.add_command(remote_set_url) bench_command.add_command(remote_reset_url) bench_command.add_command(remote_urls) + +from bench.commands.install import install +bench_command.add_command(install) \ No newline at end of file diff --git a/bench/commands/install.py b/bench/commands/install.py new file mode 100644 index 00000000..00e4f5db --- /dev/null +++ b/bench/commands/install.py @@ -0,0 +1,49 @@ +import os, sys, json, click +from bench.utils import run_playbook + +extra_vars = {"production": True} + +@click.group() +def install(): + "Install system dependancies" + pass + +@click.command('prerequisites') +def install_prerequisites(): + "Install prerequisites" + run_playbook('prerequisites/install_prerequisites.yml') + +@click.command('mariadb') +@click.option('--mysql_root_password') +def install_maridb(mysql_root_password=''): + "Install mariadb 10.1" + extra_vars.update(mysql_root_password) + run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='maridb') + +@click.command('wkhtmltopdf') +def install_wkhtmltopdf(): + run_playbook('prerequisites/install_roles.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') + +@click.command('psutil') +def install_psutil(): + run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='psutil') + +@click.command('nginx') +def install_nginx(): + run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='nginx') + +@click.command('fail2ban') +def install_failtoban(): + run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='fail2ban') + +install.add_command(install_prerequisites) +install.add_command(install_maridb) +install.add_command(install_wkhtmltopdf) +install.add_command(install_nodejs) +install.add_command(install_psutil) +install.add_command(install_nginx) +install.add_command(install_failtoban) \ No newline at end of file diff --git a/bench/commands/setup.py b/bench/commands/setup.py index b0db827f..c56f7a43 100755 --- a/bench/commands/setup.py +++ b/bench/commands/setup.py @@ -191,12 +191,6 @@ def sync_domains(domain=None, site=None): # if changed, success, else failure sys.exit(0 if changed else 1) -@click.command('prerequisites') -def setup_prerequisites(): - "Install prerequisites" - from bench.utils import run_playbook - run_playbook('prerequisites/install_prerequisites.yml') - @click.command('role') @click.argument('role') @click.option('--admin_emails', default='') @@ -234,5 +228,4 @@ setup.add_command(remove_domain) setup.add_command(sync_domains) setup.add_command(setup_firewall) setup.add_command(set_ssh_port) -setup.add_command(setup_prerequisites) setup.add_command(setup_roles) \ No newline at end of file