2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-13 16:56:33 +00:00

[fix] setup logwatch for debian and ubuntu

This commit is contained in:
Saurabh 2017-08-29 12:40:26 +05:30
parent 2e6ca1613d
commit 2525503429
8 changed files with 57 additions and 20 deletions

View File

@ -1,4 +1,4 @@
user nginx; user {{ nginx_user }};
worker_processes auto; worker_processes auto;
worker_rlimit_nofile 65535; worker_rlimit_nofile 65535;

View File

@ -0,0 +1,12 @@
---
- hosts: localhost
tasks:
- name: insert/update inputrc for history
blockinfile:
dest: "/home/{{ ansible_user_id }}/.inputrc"
create: yes
block: |
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward

View File

@ -8,7 +8,7 @@
become: yes become: yes
become_user: root become_user: root
vars: vars:
- nginx_conf_file: ../files/nginx.conf - nginx_conf_file: files/nginx.conf
roles: roles:
- locale - locale
- swap - swap
@ -26,16 +26,13 @@
- name: Start NTPD - name: Start NTPD
service: name=ntpd state=started service: name=ntpd state=started
when: ansible_distribution == 'CentOS'
- name: insert/update inputrc for history - name: Start NTPD
blockinfile: service: name=ntp state=started
dest: "/home/{{ ansible_user_id }}/.inputrc" when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
create: yes
block: | - include: includes/setup_inputrc.yml
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
# Setup Bench for production environment # Setup Bench for production environment
- include: includes/setup_bench_production.yml - include: includes/setup_bench_production.yml

View File

@ -1,6 +1,11 @@
--- ---
- name: Install fail2ban - name: Install fail2ban
yum: name=fail2ban state=present yum: name=fail2ban state=present
when: ansible_distribution == 'CentOS'
- name: Install fail2ban
apt: name=fail2ban state=present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Enable fail2ban - name: Enable fail2ban
service: name=fail2ban enabled=yes service: name=fail2ban enabled=yes

View File

@ -6,24 +6,26 @@
- selinux-policy-devel - selinux-policy-devel
when: ansible_distribution == 'CentOS' when: ansible_distribution == 'CentOS'
- name: Install SELinux for Ubuntu # - name: Install SELinux for Ubuntu
apt: name={{ item }} state=present # apt: name={{ item }} state=present
with_items: # with_items:
- selinux # - selinux
- selinux-policy-dev # - selinux-policy-dev
when: ansible_distribution == 'Ubuntu' # when: ansible_distribution == 'Ubuntu'
- name: Check enabled SELinux modules - name: Check enabled SELinux modules
shell: semanage module -l shell: semanage module -l
register: enabled_modules register: enabled_modules
when: ansible_distribution == 'CentOS'
- name: Copy frappe_selinux policy - name: Copy frappe_selinux policy
copy: src=frappe_selinux.te dest=/root/frappe_selinux.te copy: src=frappe_selinux.te dest=/root/frappe_selinux.te
register: dest_frappe_selinux_te register: dest_frappe_selinux_te
when: ansible_distribution == 'CentOS'
- name: Compile frappe_selinux policy - name: Compile frappe_selinux policy
shell: "make -f /usr/share/selinux/devel/Makefile frappe_selinux.pp && semodule -i frappe_selinux.pp" shell: "make -f /usr/share/selinux/devel/Makefile frappe_selinux.pp && semodule -i frappe_selinux.pp"
args: args:
chdir: /root/ chdir: /root/
when: "enabled_modules.stdout.find('frappe_selinux') == -1 or dest_frappe_selinux_te.changed" when: "ansible_distribution == 'CentOS' and enabled_modules.stdout.find('frappe_selinux') == -1 or dest_frappe_selinux_te.changed"

View File

@ -1,6 +1,12 @@
--- ---
- name: Install logwatch - name: Install logwatch
yum: name=logwatch state=present yum: name=logwatch state=present
when: ansible_distribution == 'CentOS'
- name: Install logwatch on Ubuntu or Debian
apt: name=logwatch state=present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Copy logwatch config - name: Copy logwatch config
template: src=logwatch.conf.j2 dest=/etc/logwatch/conf/logwatch.conf backup=yes template: src=logwatch.conf.j2 dest=/etc/logwatch/conf/logwatch.conf backup=yes
when: admin_emails is defined

View File

@ -18,6 +18,7 @@
# Replace default nginx config with nginx template # Replace default nginx config with nginx template
- name: Rename default nginx.conf to nginx.conf.old - name: Rename default nginx.conf to nginx.conf.old
command: mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old command: mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old
when: ansible_os_family == 'Debian'
# Nginx setup. # Nginx setup.
- name: Copy nginx configuration in place. - name: Copy nginx configuration in place.

View File

@ -4,6 +4,20 @@
with_items: with_items:
- ntp - ntp
- ntpdate - ntpdate
when: ansible_distribution == 'CentOS'
- name: enable ntpd - name: enable ntpd
service: name=ntpd enabled=yes state=started service: name=ntpd enabled=yes state=started
when: ansible_distribution == 'CentOS'
- name: Install ntpd
apt: name="{{item}}" state=installed
with_items:
- ntp
- ntpdate
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: enable ntpd
service: name=ntp enabled=yes state=started
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'