mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 00:37:51 +00:00
Merge pull request #495 from saurabh6790/ansible_version_fix
Ansible version fix and install supervisor via role
This commit is contained in:
commit
9c15073297
@ -1,5 +1,5 @@
|
||||
import os, sys, json, click
|
||||
from bench.utils import run_playbook
|
||||
from bench.utils import run_playbook, setup_sudoers
|
||||
|
||||
extra_vars = {"production": True}
|
||||
|
||||
@ -34,9 +34,19 @@ def install_nodejs():
|
||||
def install_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')
|
||||
def install_nginx():
|
||||
@click.option('--user')
|
||||
def install_nginx(user=None):
|
||||
run_playbook('prerequisites/install_roles.yml', extra_vars=extra_vars, tag='nginx')
|
||||
if user:
|
||||
setup_sudoers(user)
|
||||
|
||||
@click.command('fail2ban')
|
||||
def install_failtoban():
|
||||
@ -47,5 +57,6 @@ install.add_command(install_maridb)
|
||||
install.add_command(install_wkhtmltopdf)
|
||||
install.add_command(install_nodejs)
|
||||
install.add_command(install_psutil)
|
||||
install.add_command(install_supervisor)
|
||||
install.add_command(install_nginx)
|
||||
install.add_command(install_failtoban)
|
@ -61,7 +61,7 @@ def install_bench(args):
|
||||
# Restricting ansible version due to following bug in ansible 2.1
|
||||
# https://github.com/ansible/ansible-modules-core/issues/3752
|
||||
success = run_os_command({
|
||||
'pip': "sudo pip install ansible"
|
||||
'pip': "sudo pip install ansible==2.3.1"
|
||||
})
|
||||
|
||||
if not success:
|
||||
|
@ -33,7 +33,6 @@
|
||||
- redis
|
||||
- screen
|
||||
- sudo
|
||||
- supervisor
|
||||
- tcl-devel
|
||||
- tk-devel
|
||||
- vim
|
||||
@ -72,7 +71,6 @@
|
||||
- python-tk
|
||||
- redis-server
|
||||
- screen
|
||||
- supervisor
|
||||
- vim
|
||||
- xfonts-75dpi
|
||||
- xfonts-base
|
||||
|
@ -19,6 +19,7 @@
|
||||
- { role: wkhtmltopdf, tags: "wkhtmltopdf" }
|
||||
- { role: nodejs, tags: "nodejs" }
|
||||
- { role: psutil, tags: "psutil" }
|
||||
- { role: supervisor, tags: "supervisor", when: production }
|
||||
- { role: nginx, tags: "nginx", when: production }
|
||||
- { role: fail2ban, tags: "fail2ban" , when: production }
|
||||
tasks:
|
||||
|
8
playbooks/prerequisites/roles/supervisor/tasks/main.yml
Normal file
8
playbooks/prerequisites/roles/supervisor/tasks/main.yml
Normal 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'
|
@ -6,6 +6,7 @@
|
||||
# For CentOS
|
||||
- name: Enable SELinux
|
||||
selinux: policy=targeted state=permissive
|
||||
when: ansible_distribution == 'CentOS'
|
||||
|
||||
- name: Install firewalld
|
||||
yum: name=firewalld state=present
|
||||
@ -29,7 +30,10 @@
|
||||
|
||||
# For Ubuntu / Debian
|
||||
- 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'
|
||||
|
||||
- name: Enable Firewall
|
||||
|
Loading…
Reference in New Issue
Block a user