From af16ee3eec3af39331f284c990f21bc0d0c43c37 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 18 Sep 2017 12:37:55 +0530 Subject: [PATCH] [fix] add commands to sudoer --- bench/cli.py | 4 +++- bench/commands/install.py | 6 ++++-- playbooks/production/setup_firewall.yml | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index 0ca2fe10..f9c80fba 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -47,7 +47,9 @@ def check_uid(): sys.exit(1) def cmd_requires_root(): - if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers', 'lets-encrypt', 'fonts', 'print', 'firewall', 'ssh-port', 'prerequisites', 'role'): + if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers', 'lets-encrypt', 'fonts', + 'print', 'firewall', 'ssh-port', 'prerequisites', 'role', 'mariadb', 'wkhtmltopdf', + 'nodejs', 'psutil', 'nginx', 'fail2ban'): return True if len(sys.argv) >= 2 and sys.argv[1] in ('patch', 'renew-lets-encrypt', 'disable-production'): return True diff --git a/bench/commands/install.py b/bench/commands/install.py index 00e4f5db..e8c031ab 100644 --- a/bench/commands/install.py +++ b/bench/commands/install.py @@ -17,8 +17,10 @@ def install_prerequisites(): @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') + 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') @click.command('wkhtmltopdf') def install_wkhtmltopdf(): diff --git a/playbooks/production/setup_firewall.yml b/playbooks/production/setup_firewall.yml index e9242eb3..9b400bdf 100755 --- a/playbooks/production/setup_firewall.yml +++ b/playbooks/production/setup_firewall.yml @@ -20,7 +20,7 @@ with_items: - 80 - 443 - - {{ ssh_port }} + - "{{ ssh_port }}" when: ansible_distribution == 'CentOS' - name: Restart Firewall @@ -41,6 +41,6 @@ with_items: - 80 - 443 - - {{ ssh_port }} + - "{{ ssh_port }}" when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'