2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +00:00

Merge pull request #495 from saurabh6790/ansible_version_fix

Ansible version fix and install supervisor via role
This commit is contained in:
Saurabh 2017-10-11 15:12:41 +05:30 committed by GitHub
commit 9c15073297
6 changed files with 28 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import os, sys, json, click import os, sys, json, click
from bench.utils import run_playbook from bench.utils import run_playbook, setup_sudoers
extra_vars = {"production": True} extra_vars = {"production": True}
@ -34,9 +34,19 @@ def install_nodejs():
def install_psutil(): def install_psutil():
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='psutil') run_playbook('prerequisites/install_roles.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')
if user:
setup_sudoers(user)
@click.command('nginx') @click.command('nginx')
def install_nginx(): @click.option('--user')
def install_nginx(user=None):
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='nginx') run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='nginx')
if user:
setup_sudoers(user)
@click.command('fail2ban') @click.command('fail2ban')
def install_failtoban(): def install_failtoban():
@ -47,5 +57,6 @@ install.add_command(install_maridb)
install.add_command(install_wkhtmltopdf) install.add_command(install_wkhtmltopdf)
install.add_command(install_nodejs) install.add_command(install_nodejs)
install.add_command(install_psutil) install.add_command(install_psutil)
install.add_command(install_supervisor)
install.add_command(install_nginx) install.add_command(install_nginx)
install.add_command(install_failtoban) install.add_command(install_failtoban)

View File

@ -61,7 +61,7 @@ def install_bench(args):
# Restricting ansible version due to following bug in ansible 2.1 # Restricting ansible version due to following bug in ansible 2.1
# https://github.com/ansible/ansible-modules-core/issues/3752 # https://github.com/ansible/ansible-modules-core/issues/3752
success = run_os_command({ success = run_os_command({
'pip': "sudo pip install ansible" 'pip': "sudo pip install ansible==2.3.1"
}) })
if not success: if not success:

View File

@ -33,7 +33,6 @@
- redis - redis
- screen - screen
- sudo - sudo
- supervisor
- tcl-devel - tcl-devel
- tk-devel - tk-devel
- vim - vim
@ -72,7 +71,6 @@
- python-tk - python-tk
- redis-server - redis-server
- screen - screen
- supervisor
- vim - vim
- xfonts-75dpi - xfonts-75dpi
- xfonts-base - xfonts-base

View File

@ -19,6 +19,7 @@
- { role: wkhtmltopdf, tags: "wkhtmltopdf" } - { role: wkhtmltopdf, tags: "wkhtmltopdf" }
- { role: nodejs, tags: "nodejs" } - { role: nodejs, tags: "nodejs" }
- { role: psutil, tags: "psutil" } - { role: psutil, tags: "psutil" }
- { role: supervisor, tags: "supervisor", when: production }
- { role: nginx, tags: "nginx", when: production } - { role: nginx, tags: "nginx", when: production }
- { role: fail2ban, tags: "fail2ban" , when: production } - { role: fail2ban, tags: "fail2ban" , when: production }
tasks: tasks:

View File

@ -0,0 +1,8 @@
---
- name: Install supervisor on centos
yum: name=supervisor state=present
when: ansible_os_family == 'RedHat'
- name: Install supervisor on debian
apt: pkg=supervisor state=present force=yes
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

View File

@ -6,6 +6,7 @@
# For CentOS # For CentOS
- name: Enable SELinux - name: Enable SELinux
selinux: policy=targeted state=permissive selinux: policy=targeted state=permissive
when: ansible_distribution == 'CentOS'
- name: Install firewalld - name: Install firewalld
yum: name=firewalld state=present yum: name=firewalld state=present
@ -29,7 +30,10 @@
# For Ubuntu / Debian # For Ubuntu / Debian
- name: Install ufw - name: Install ufw
apt: name=ufw state=present apt: name={{ item }} state=present force=yes
with_items:
- python-selinux
- ufw
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian' when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
- name: Enable Firewall - name: Enable Firewall