diff --git a/bench/commands/setup.py b/bench/commands/setup.py index 622c6f74..13517442 100755 --- a/bench/commands/setup.py +++ b/bench/commands/setup.py @@ -1,3 +1,4 @@ +from bench.utils import exec_cmd import click, sys, json @click.group() @@ -51,6 +52,9 @@ def setup_fonts(): def setup_production(user, yes=False): "setup bench for production" from bench.config.production_setup import setup_production + # Install prereqs for production + exec_cmd("sudo pip install ansible") + run_playbook('site.yml', tag='production') setup_production(user=user, yes=yes) diff --git a/playbooks/install.py b/playbooks/install.py index 8abec392..cd7026eb 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -59,7 +59,7 @@ def install_bench(args): }) success = run_os_command({ - 'pip': "sudo pip install ansible==2.5.0" + 'pip': "sudo pip install ansible" }) if not success: diff --git a/playbooks/site.yml b/playbooks/site.yml index f3f4d7cf..87986ada 100644 --- a/playbooks/site.yml +++ b/playbooks/site.yml @@ -5,22 +5,22 @@ become: yes become_user: root roles: - - { role: common, tags: "common" } - - { role: locale, tags: "locale" } - - { role: swap, tags: "swap", when: production } - - { role: logwatch, tags: "logwatch", when: production } - - { role: bash_screen_wall, tags: "bash_screen_wall", when: production } - - { role: frappe_selinux, tags: "frappe_selinux", when: production } - - { role: dns_caching, tags: "dns_caching", when: production } - - { role: ntpd, tags: "ntpd", when: production } - - { role: mariadb, tags: "mariadb" } - - { role: wkhtmltopdf, tags: "wkhtmltopdf" } - - { role: nodejs, tags: "nodejs" } - - { role: psutil, tags: "psutil" } - - { role: redis, tags: "redis" } - - { role: supervisor, tags: "supervisor", when: production } - - { role: nginx, tags: "nginx", when: production } - - { role: fail2ban, tags: "fail2ban", when: production } + - { role: common, tags: "common" } + - { role: locale, tags: "locale" } + - { role: swap, tags: "swap", "production" when: production } + - { role: logwatch, tags: "logwatch", "production" when: production } + - { role: bash_screen_wall, tags: "bash_screen_wall", "production" when: production } + - { role: frappe_selinux, tags: "frappe_selinux", "production" when: production } + - { role: dns_caching, tags: "dns_caching", "production" when: production } + - { role: ntpd, tags: "ntpd", "production" when: production } + - { role: mariadb, tags: "mariadb" } + - { role: wkhtmltopdf, tags: "wkhtmltopdf" } + - { role: nodejs, tags: "nodejs" } + - { role: psutil, tags: "psutil" } + - { role: redis, tags: "redis" } + - { role: supervisor, tags: "supervisor", "production" when: production } + - { role: nginx, tags: "nginx", "production" when: production } + - { role: fail2ban, tags: "fail2ban", "production" when: production } tasks: - name: Set hostname hostname: name='{{ hostname }}'