mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
create roles to install pre-requisites
This commit is contained in:
parent
7a7c61105c
commit
a07c71654b
@ -1,13 +1,26 @@
|
||||
---
|
||||
- include: setup_essentials.yml
|
||||
|
||||
- hosts: localhost
|
||||
become: yes
|
||||
become_user: root
|
||||
vars:
|
||||
bench_repo_path: "/home/{{ ansible_user_id }}/.bench"
|
||||
bench_path: "/home/{{ ansible_user_id }}/frappe-bench"
|
||||
mysql_config_template: "templates/simple_mariadb_config.cnf"
|
||||
mysql_conf_dir: /etc/my.cnf.d/
|
||||
|
||||
mysql_conf_tpl: ../files/mariadb_config.cnf
|
||||
mysql_secure_installation: True
|
||||
roles:
|
||||
- prerequisites
|
||||
- mariadb
|
||||
- wkhtmltopdf
|
||||
- nodejs
|
||||
- psutils
|
||||
tasks:
|
||||
# setup frappe-bench
|
||||
- include: includes/setup_bench.yml
|
||||
when: not run_travis and not without_bench_setup
|
||||
|
||||
<<<<<<< 7a7c61105c87ac4cccea9c39c23691b0a61f9836
|
||||
- name: development tools package
|
||||
yum: name="@Development tools" state=present
|
||||
become: yes
|
||||
@ -84,4 +97,9 @@
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not run_travis and not production
|
||||
|
||||
|
||||
=======
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not run_travis and not production
|
||||
>>>>>>> create roles to install pre-requisites
|
||||
|
@ -1,127 +1,35 @@
|
||||
---
|
||||
- include: setup_essentials.yml
|
||||
|
||||
- hosts: localhost
|
||||
become: yes
|
||||
become_user: root
|
||||
vars:
|
||||
bench_repo_path: "/home/{{ ansible_user_id }}/.bench"
|
||||
bench_path: "/home/{{ ansible_user_id }}/frappe-bench"
|
||||
mysql_config_template: "templates/simple_mariadb_config.cnf"
|
||||
mysql_conf_tpl: ../files/mariadb_config.cnf
|
||||
mysql_conf_dir: /etc/mysql/conf.d/
|
||||
|
||||
roles:
|
||||
- prerequisites
|
||||
- mariadb
|
||||
- wkhtmltopdf
|
||||
- nodejs
|
||||
- psutils
|
||||
tasks:
|
||||
- debug:
|
||||
var: run_travis
|
||||
|
||||
- name: Add dotdeb apt repository key for Debian < 8
|
||||
apt_key:
|
||||
url: http://www.dotdeb.org/dotdeb.gpg
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt')
|
||||
|
||||
- name: Add dotdeb apt repository for redis-server for Debian < 8
|
||||
apt_repository:
|
||||
repo: 'deb http://packages.dotdeb.org wheezy all'
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt')
|
||||
|
||||
# install pre-requisites
|
||||
- name: install prequisites
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
# basic installs
|
||||
- build-essential
|
||||
- redis-server
|
||||
|
||||
# for mariadb
|
||||
- software-properties-common
|
||||
|
||||
# for wkhtmltopdf
|
||||
- libxrender1
|
||||
- libxext6
|
||||
- xfonts-75dpi
|
||||
- xfonts-base
|
||||
|
||||
# for Pillow
|
||||
- zlib1g-dev
|
||||
- libfreetype6-dev
|
||||
- liblcms2-dev
|
||||
- libwebp-dev
|
||||
- python-tk
|
||||
|
||||
# Ensure apt-transport-https
|
||||
- apt-transport-https
|
||||
|
||||
# Python LDAP
|
||||
- libsasl2-dev
|
||||
- libldap2-dev
|
||||
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: install pillow prerequisites for Debian < 8
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
- libjpeg8-dev
|
||||
- libtiff4-dev
|
||||
- tcl8.5-dev
|
||||
- tk8.5-dev
|
||||
when: ansible_distribution_version | version_compare('8', 'lt')
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: install pillow prerequisites for Debian >= 8
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
- libjpeg62-turbo-dev
|
||||
- libtiff5-dev
|
||||
- tcl8.5-dev
|
||||
- tk8.5-dev
|
||||
when: ansible_distribution_version | version_compare('8', 'ge')
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Add apt key for node repo
|
||||
apt_key:
|
||||
url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280
|
||||
id: "68576280"
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Add repo
|
||||
apt_repository:
|
||||
repo: "deb [arch=amd64,i386] https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
update_cache: yes
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Install nodejs 6.x
|
||||
apt:
|
||||
name: nodejs
|
||||
state: present
|
||||
update_cache: yes
|
||||
force: yes
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
# install MariaDB
|
||||
- include: includes/mariadb_debian.yml
|
||||
|
||||
# install WKHTMLtoPDF
|
||||
- include: includes/wkhtmltopdf.yml
|
||||
|
||||
# setup MariaDB
|
||||
- include: includes/setup_mariadb.yml
|
||||
|
||||
- debug:
|
||||
var: run_travis
|
||||
|
||||
# setup frappe-bench
|
||||
- include: includes/setup_bench.yml
|
||||
when: not run_travis
|
||||
# setup frappe-bench
|
||||
- include: includes/setup_bench.yml
|
||||
when: not run_travis
|
||||
|
||||
<<<<<<< 7a7c61105c87ac4cccea9c39c23691b0a61f9836
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not production and not run_travis
|
||||
|
||||
=======
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not production and not run_travis
|
||||
>>>>>>> create roles to install pre-requisites
|
||||
|
@ -1,13 +0,0 @@
|
||||
---
|
||||
- name: Add repository
|
||||
template: src=templates/mariadb_centos.repo dest=/etc/yum.repos.d/MariaDB.repo owner=root mode=0644
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Install MariaDB
|
||||
yum: pkg={{ item }} state=present
|
||||
with_items:
|
||||
- MariaDB-server
|
||||
- MariaDB-client
|
||||
become: yes
|
||||
become_user: root
|
@ -1,27 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Add apt key for mariadb for Debian <= 8
|
||||
apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xcbcb082a1bb943db state=present
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution_major_version | version_compare('8', 'le')
|
||||
|
||||
- name: Add apt repository
|
||||
apt_repository:
|
||||
repo: 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/debian {{ ansible_distribution_release }} main'
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Unattended package installation
|
||||
shell: export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
- name: apt-get install
|
||||
apt: pkg={{ item }} update_cache=yes state=present
|
||||
with_items:
|
||||
- mariadb-server
|
||||
- mariadb-client
|
||||
- mariadb-common
|
||||
- libmariadbclient-dev
|
||||
become: yes
|
||||
become_user: root
|
@ -1,32 +0,0 @@
|
||||
---
|
||||
- name: Add apt key for mariadb for Ubuntu < 16.04
|
||||
apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xcbcb082a1bb943db state=present
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution_version | version_compare('16.04', 'lt')
|
||||
|
||||
- name: Add apt key for mariadb for Ubuntu >= 16.04
|
||||
apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xF1656F24C74CD1D8 state=present
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution_version | version_compare('16.04', 'ge')
|
||||
|
||||
- name: Add apt repository
|
||||
apt_repository:
|
||||
repo: 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu {{ ansible_distribution_release }} main'
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Unattended package installation
|
||||
shell: export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
- name: apt-get install
|
||||
apt: pkg={{ item }} update_cache=yes state=present
|
||||
with_items:
|
||||
- mariadb-server
|
||||
- mariadb-client
|
||||
- mariadb-common
|
||||
- libmariadbclient-dev
|
||||
become: yes
|
||||
become_user: root
|
@ -1,19 +0,0 @@
|
||||
---
|
||||
- name: download wkthmltox linux
|
||||
get_url: url=https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-{{ "amd64" if ansible_architecture == "x86_64" else "i386"}}.tar.xz dest=/tmp/wkhtmltox.tar.xz
|
||||
|
||||
- name: Creates directory
|
||||
file: path=/tmp/wkhtmltox state=directory
|
||||
|
||||
- name: unarchive wkhtmltopdf
|
||||
unarchive: src=/tmp/wkhtmltox.tar.xz dest=/tmp
|
||||
|
||||
- name: copy to /usr/local/bin
|
||||
copy: src="/tmp/wkhtmltox/bin/wkhtmltopdf" dest="/usr/local/bin/wkhtmltopdf"
|
||||
become: true
|
||||
become_user: root
|
||||
|
||||
- name: make wkhtmltopdf executable
|
||||
file: path=/usr/local/bin/wkhtmltopdf mode="o+x"
|
||||
become: true
|
||||
become_user: root
|
@ -1,35 +1,39 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
become: yes
|
||||
become_user: root
|
||||
vars:
|
||||
bench_repo_path: "/Users/{{ ansible_user_id }}/.bench"
|
||||
bench_path: "/Users/{{ ansible_user_id }}/frappe-bench"
|
||||
mysql_config_template: "templates/simple_mariadb_config.cnf"
|
||||
mysql_conf_dir: /usr/local/etc/my.cnf.d
|
||||
|
||||
tasks:
|
||||
# install pre-requisites
|
||||
- name: install prequisites
|
||||
homebrew: name={{ item }} state=present
|
||||
with_items:
|
||||
- cmake
|
||||
- redis
|
||||
- mariadb
|
||||
- nodejs
|
||||
|
||||
# install pre-requisites
|
||||
- name: install prequisites
|
||||
homebrew: name={{ item }} state=present
|
||||
with_items:
|
||||
- cmake
|
||||
- redis
|
||||
- mariadb
|
||||
- nodejs
|
||||
# install wkhtmltopdf
|
||||
- name: cask installs
|
||||
homebrew_cask: name={{ item }} state=present
|
||||
with_items:
|
||||
- wkhtmltopdf
|
||||
|
||||
# install wkhtmltopdf
|
||||
- name: cask installs
|
||||
homebrew_cask: name={{ item }} state=present
|
||||
with_items:
|
||||
- wkhtmltopdf
|
||||
- name: configure mariadb
|
||||
include_role:
|
||||
name: mariadb
|
||||
vars:
|
||||
mysql_conf_tpl: ../files/mariadb_config.cnf
|
||||
|
||||
# setup MariaDB
|
||||
- include: includes/setup_mariadb.yml
|
||||
- name: Install MySQLdb in global env
|
||||
pip: name=mysql-python version=1.2.5
|
||||
|
||||
# setup frappe-bench
|
||||
- include: includes/setup_bench.yml
|
||||
# setup frappe-bench
|
||||
- include: includes/setup_bench.yml
|
||||
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not production
|
||||
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not production
|
||||
|
64
playbooks/develop/roles/mariadb/README.md
Normal file
64
playbooks/develop/roles/mariadb/README.md
Normal file
@ -0,0 +1,64 @@
|
||||
# Ansible Role: MariaDB
|
||||
|
||||
Installs MariaDB
|
||||
|
||||
## Supported platforms
|
||||
|
||||
```
|
||||
CentOS 6 & 7
|
||||
Ubuntu 14.04
|
||||
```
|
||||
|
||||
## Post install
|
||||
|
||||
Run `mysql_secure_installation`
|
||||
|
||||
## Requirements
|
||||
|
||||
None
|
||||
|
||||
## Role Variables
|
||||
|
||||
MariaDB version:
|
||||
|
||||
```
|
||||
mariadb_version: 10.0
|
||||
```
|
||||
|
||||
Configuration template:
|
||||
|
||||
```
|
||||
mysql_conf_tpl: change_me
|
||||
```
|
||||
|
||||
Configuration filename:
|
||||
|
||||
```
|
||||
mysql_conf_file: settings.cnf
|
||||
```
|
||||
|
||||
### Experimental unattended mysql_secure_installation
|
||||
|
||||
```
|
||||
ansible-playbook release.yml --extra-vars "mysql_secure_installation=true mysql_root_password=your_very_secret_password"
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
None
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: pcextreme.mariadb }
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT / BSD
|
||||
|
||||
## Author Information
|
||||
|
||||
Created by [Attila van der Velde](https://github.com/vdvm)
|
7
playbooks/develop/roles/mariadb/defaults/main.yml
Normal file
7
playbooks/develop/roles/mariadb/defaults/main.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
mariadb_version: 10.0
|
||||
|
||||
mysql_conf_tpl: change_me
|
||||
mysql_conf_file: settings.cnf
|
||||
|
||||
mysql_secure_installation: false
|
3
playbooks/develop/roles/mariadb/handlers/main.yml
Normal file
3
playbooks/develop/roles/mariadb/handlers/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: restart mysql
|
||||
service: name=mysql state=restarted
|
19
playbooks/develop/roles/mariadb/meta/main.yml
Normal file
19
playbooks/develop/roles/mariadb/meta/main.yml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Attila van der Velde"
|
||||
description: "Installs MariaDB"
|
||||
company: "PCextreme B.V."
|
||||
license: "license (MIT, BSD)"
|
||||
min_ansible_version: 1.8
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- trusty
|
||||
categories:
|
||||
- database:sql
|
||||
|
||||
dependencies: []
|
12
playbooks/develop/roles/mariadb/tasks/centos.yml
Normal file
12
playbooks/develop/roles/mariadb/tasks/centos.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Add repo file
|
||||
template: src=mariadb_centos.repo.j2 dest=/etc/yum.repos.d/mariadb.repo owner=root group=root mode=0644
|
||||
|
||||
- name: Install MariaDB
|
||||
yum: name={{ item }} enablerepo=mariadb state=present
|
||||
with_items:
|
||||
- MariaDB-server
|
||||
- MariaDB-client
|
||||
- MySQL-python
|
||||
- MariaDB-devel
|
||||
|
21
playbooks/develop/roles/mariadb/tasks/debian.yml
Normal file
21
playbooks/develop/roles/mariadb/tasks/debian.yml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
|
||||
- name: Add apt key for mariadb for Debian <= 8
|
||||
apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xcbcb082a1bb943db state=present
|
||||
when: ansible_distribution_major_version | version_compare('8', 'le')
|
||||
|
||||
- name: Add apt repository
|
||||
apt_repository:
|
||||
repo: 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/debian {{ ansible_distribution_release }} main'
|
||||
state: present
|
||||
|
||||
- name: Unattended package installation
|
||||
shell: export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
- name: apt-get install
|
||||
apt: pkg={{ item }} update_cache=yes state=present
|
||||
with_items:
|
||||
- mariadb-server
|
||||
- mariadb-client
|
||||
- mariadb-common
|
||||
- libmariadbclient-dev
|
21
playbooks/develop/roles/mariadb/tasks/main.yml
Normal file
21
playbooks/develop/roles/mariadb/tasks/main.yml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
- include: centos.yml
|
||||
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version|int >= 6
|
||||
|
||||
- include: ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
- include: debian.yml
|
||||
when: ansible_distribution == 'Debian'
|
||||
|
||||
- name: Add configuration
|
||||
template: src={{ mysql_conf_tpl }} dest={{ mysql_conf_dir[ansible_distribution] }}/{{ mysql_conf_file }} owner=root group=root mode=0644
|
||||
when: mysql_conf_tpl != 'change_me'
|
||||
notify: restart mysql
|
||||
|
||||
- name: Start and enable service
|
||||
service: name=mysql state=started enabled=yes
|
||||
|
||||
- include: mysql_secure_installation.yml
|
||||
- debug: var=mysql_secure_installation
|
||||
when: mysql_secure_installation and mysql_root_password is defined
|
@ -0,0 +1,64 @@
|
||||
---
|
||||
# Set root password
|
||||
# UPDATE mysql.user SET Password=PASSWORD('mysecret') WHERE User='root';
|
||||
# FLUSH PRIVILEGES;
|
||||
|
||||
|
||||
- name: Set root Password
|
||||
mysql_user: name=root host={{ item }} password={{ mysql_root_password }} state=present
|
||||
with_items:
|
||||
- localhost
|
||||
- 127.0.0.1
|
||||
- ::1
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Add .my.cnf
|
||||
template: src=my.cnf.j2 dest=/root/.my.cnf owner=root group=root mode=0600
|
||||
|
||||
- name: Reload privilege tables
|
||||
command: 'mysql -ne "{{ item }}"'
|
||||
with_items:
|
||||
- FLUSH PRIVILEGES
|
||||
changed_when: False
|
||||
|
||||
- name: Remove anonymous users
|
||||
command: 'mysql -ne "{{ item }}"'
|
||||
with_items:
|
||||
- DELETE FROM mysql.user WHERE User=''
|
||||
changed_when: False
|
||||
|
||||
- name: Disallow root login remotely
|
||||
command: 'mysql -ne "{{ item }}"'
|
||||
with_items:
|
||||
- DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
|
||||
changed_when: False
|
||||
|
||||
- name: Remove test database and access to it
|
||||
command: 'mysql -ne "{{ item }}"'
|
||||
with_items:
|
||||
- DROP DATABASE if exists test
|
||||
- DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'
|
||||
changed_when: False
|
||||
ignore_errors: True
|
||||
|
||||
- name: Reload privilege tables
|
||||
command: 'mysql -ne "{{ item }}"'
|
||||
with_items:
|
||||
- FLUSH PRIVILEGES
|
||||
changed_when: False
|
||||
|
||||
- name: add launchagents folder mac
|
||||
file: path=~/Library/LaunchAgents state=directory
|
||||
when: ansible_distribution == 'MacOSX'
|
||||
|
||||
- name: add mysql to mac startup
|
||||
file: src=/usr/local/opt/mariadb/homebrew.mxcl.mariadb.plist path=~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist state=link force=yes
|
||||
when: ansible_distribution == 'MacOSX'
|
||||
|
||||
- name: stop mysql mac
|
||||
command: launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
|
||||
when: ansible_distribution == 'MacOSX'
|
||||
|
||||
- name: start mysql mac
|
||||
command: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
|
||||
when: ansible_distribution == 'MacOSX'
|
31
playbooks/develop/roles/mariadb/tasks/ubuntu.yml
Normal file
31
playbooks/develop/roles/mariadb/tasks/ubuntu.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
- name: Add repo file
|
||||
template: src=mariadb_ubuntu.list.j2 dest=/etc/apt/sources.list.d/mariadb.list owner=root group=root mode=0644
|
||||
register: mariadb_list
|
||||
|
||||
- name: Add repo key
|
||||
apt_key: id=1BB943DB url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xCBCB082A1BB943DB state=present
|
||||
register: mariadb_key
|
||||
when: ansible_distribution_version | version_compare('16.04', 'lt')
|
||||
|
||||
- name: Add apt key for mariadb for Ubuntu >= 16.04
|
||||
apt_key: id=C74CD1D8 url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xF1656F24C74CD1D8 state=present
|
||||
register: mariadb_key
|
||||
when: ansible_distribution_version | version_compare('16.04', 'ge')
|
||||
|
||||
- name: Update apt cache
|
||||
apt: update_cache=yes
|
||||
when: mariadb_list.changed == True or mariadb_key.changed == True
|
||||
|
||||
- name: Unattended package installation
|
||||
shell: export DEBIAN_FRONTEND=noninteractive
|
||||
changed_when: false
|
||||
|
||||
- name: Install MariaDB
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
- mariadb-server
|
||||
- mariadb-client
|
||||
- mariadb-common
|
||||
- libmariadbclient-dev
|
||||
- python-mysqldb
|
@ -0,0 +1,7 @@
|
||||
# MariaDB CentOS {{ ansible_distribution_major_version|int }} repository list
|
||||
# http://mariadb.org/mariadb/repositories/
|
||||
[mariadb]
|
||||
name = MariaDB
|
||||
baseurl = http://yum.mariadb.org/{{ mariadb_version }}/centos{{ ansible_distribution_major_version|int }}-amd64
|
||||
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
|
||||
gpgcheck=1
|
@ -0,0 +1,4 @@
|
||||
# MariaDB Ubuntu {{ ansible_distribution_release | title }} repository list
|
||||
# http://mariadb.org/mariadb/repositories/
|
||||
deb http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main
|
||||
deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main
|
3
playbooks/develop/roles/mariadb/templates/my.cnf.j2
Normal file
3
playbooks/develop/roles/mariadb/templates/my.cnf.j2
Normal file
@ -0,0 +1,3 @@
|
||||
[client]
|
||||
user=root
|
||||
password={{ mysql_root_password }}
|
6
playbooks/develop/roles/mariadb/vars/main.yml
Normal file
6
playbooks/develop/roles/mariadb/vars/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
mysql_conf_dir:
|
||||
"CentOS": /etc/my.cnf.d
|
||||
"Ubuntu": /etc/mysql/conf.d
|
||||
"Debian": /etc/mysql/conf.d
|
||||
"MacOSX": /usr/local/etc/my.cnf.d
|
35
playbooks/develop/roles/nginx/.travis.yml
Normal file
35
playbooks/develop/roles/nginx/.travis.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
env:
|
||||
- SITE=test.yml
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y curl
|
||||
|
||||
install:
|
||||
# Install Ansible.
|
||||
- pip install ansible
|
||||
|
||||
# Add ansible.cfg to pick up roles path.
|
||||
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
|
||||
|
||||
script:
|
||||
# Check the role/playbook's syntax.
|
||||
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"
|
||||
|
||||
# Run the role/playbook with ansible-playbook.
|
||||
- "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo"
|
||||
|
||||
# Run the role/playbook again, checking to make sure it's idempotent.
|
||||
- >
|
||||
ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo
|
||||
| grep -q 'changed=0.*failed=0'
|
||||
&& (echo 'Idempotence test: pass' && exit 0)
|
||||
|| (echo 'Idempotence test: fail' && exit 1)
|
||||
|
||||
# TODO - get the test working. Probably need to add a virtual host.
|
||||
# Request a page via Nginx, to make sure Nginx is running and responds.
|
||||
# - "curl http://localhost/"
|
82
playbooks/develop/roles/nginx/README.md
Normal file
82
playbooks/develop/roles/nginx/README.md
Normal file
@ -0,0 +1,82 @@
|
||||
# Ansible Role: Nginx
|
||||
|
||||
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-nginx.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-nginx)
|
||||
|
||||
Installs Nginx on RedHat/CentOS or Debian/Ubuntu linux servers.
|
||||
|
||||
This role installs and configures the latest version of Nginx from the Nginx yum repository (on RedHat-based systems) or via apt (on Debian-based systems). You will likely need to do extra setup work after this role has installed Nginx, like adding your own [virtualhost].conf file inside `/etc/nginx/conf.d/`, describing the location and options to use for your particular website.
|
||||
|
||||
## Requirements
|
||||
|
||||
None.
|
||||
|
||||
## Role Variables
|
||||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
nginx_vhosts: []
|
||||
|
||||
A list of vhost definitions (server blocks) for Nginx virtual hosts. If left empty, you will need to supply your own virtual host configuration. See the commented example in `defaults/main.yml` for available server options. If you have a large number of customizations required for your server definition(s), you're likely better off managing the vhost configuration file yourself, leaving this variable set to `[]`.
|
||||
|
||||
nginx_remove_default_vhost: false
|
||||
|
||||
Whether to remove the 'default' virtualhost configuration supplied by Nginx. Useful if you want the base `/` URL to be directed at one of your own virtual hosts configured in a separate .conf file.
|
||||
|
||||
nginx_upstreams: []
|
||||
|
||||
If you are configuring Nginx as a load balancer, you can define one or more upstream sets using this variable. In addition to defining at least one upstream, you would need to configure one of your server blocks to proxy requests through the defined upstream (e.g. `proxy_pass http://myapp1;`). See the commented example in `defaults/main.yml` for more information.
|
||||
|
||||
nginx_user: "nginx"
|
||||
|
||||
The user under which Nginx will run. Defaults to `nginx` for RedHat, and `www-data` for Debian.
|
||||
|
||||
nginx_worker_processes: "1"
|
||||
nginx_worker_connections: "1024"
|
||||
|
||||
`nginx_worker_processes` should be set to the number of cores present on your machine. Connections (find this number with `grep processor /proc/cpuinfo | wc -l`). `nginx_worker_connections` is the number of connections per process. Set this higher to handle more simultaneous connections (and remember that a connection will be used for as long as the keepalive timeout duration for every client!).
|
||||
|
||||
nginx_error_log: "/var/log/nginx/error.log warn"
|
||||
nginx_access_log: "/var/log/nginx/access.log main buffer=16k"
|
||||
|
||||
Configuration of the default error and access logs. Set to `off` to disable a log entirely.
|
||||
|
||||
nginx_sendfile: "on"
|
||||
nginx_tcp_nopush: "on"
|
||||
nginx_tcp_nodelay: "on"
|
||||
|
||||
TCP connection options. See [this blog post](https://t37.net/nginx-optimization-understanding-sendfile-tcp_nodelay-and-tcp_nopush.html) for more information on these directives.
|
||||
|
||||
nginx_keepalive_timeout: "65"
|
||||
nginx_keepalive_requests: "100"
|
||||
|
||||
Nginx keepalive settings. Timeout should be set higher (10s+) if you have more polling-style traffic (AJAX-powered sites especially), or lower (<10s) if you have a site where most users visit a few pages and don't send any further requests.
|
||||
|
||||
nginx_client_max_body_size: "64m"
|
||||
|
||||
This value determines the largest file upload possible, as uploads are passed through Nginx before hitting a backend like `php-fpm`. If you get an error like `client intended to send too large body`, it means this value is set too low.
|
||||
|
||||
nginx_proxy_cache_path: ""
|
||||
|
||||
Set as the `proxy_cache_path` directive in the `nginx.conf` file. By default, this will not be configured (if left as an empty string), but if you wish to use Nginx as a reverse proxy, you can set this to a valid value (e.g. `"/var/cache/nginx keys_zone=cache:32m"`) to use Nginx's cache (further proxy configuration can be done in individual server configurations).
|
||||
|
||||
nginx_default_release: ""
|
||||
|
||||
(For Debian/Ubuntu only) Allows you to set a different repository for the installation of Nginx. As an example, if you are running Debian's wheezy release, and want to get a newer version of Nginx, you can install the `wheezy-backports` repository and set that value here, and Ansible will use that as the `-t` option while installing Nginx.
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
- hosts: server
|
||||
roles:
|
||||
- { role: geerlingguy.nginx }
|
||||
|
||||
## License
|
||||
|
||||
MIT / BSD
|
||||
|
||||
## Author Information
|
||||
|
||||
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).
|
48
playbooks/develop/roles/nginx/defaults/main.yml
Normal file
48
playbooks/develop/roles/nginx/defaults/main.yml
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
# Used only for Debian/Ubuntu installation, as the -t option for apt.
|
||||
nginx_default_release: ""
|
||||
|
||||
nginx_worker_processes: "1"
|
||||
nginx_worker_connections: "1024"
|
||||
|
||||
nginx_error_log: "/var/log/nginx/error.log warn"
|
||||
nginx_access_log: "/var/log/nginx/access.log main buffer=16k"
|
||||
|
||||
nginx_sendfile: "on"
|
||||
nginx_tcp_nopush: "on"
|
||||
nginx_tcp_nodelay: "on"
|
||||
|
||||
nginx_keepalive_timeout: "65"
|
||||
nginx_keepalive_requests: "100"
|
||||
|
||||
nginx_client_max_body_size: "64m"
|
||||
|
||||
nginx_proxy_cache_path: ""
|
||||
|
||||
nginx_remove_default_vhost: false
|
||||
nginx_vhosts: []
|
||||
# Example vhost below, showing all available options:
|
||||
# - {
|
||||
# listen: "80 default_server", # default: "80 default_server"
|
||||
# server_name: "example.com", # default: N/A
|
||||
# root: "/var/www/example.com", # default: N/A
|
||||
# index: "index.html index.htm", # default: "index.html index.htm"
|
||||
#
|
||||
# # Properties that are only added if defined:
|
||||
# error_page: "",
|
||||
# access_log: "",
|
||||
# extra_config: "" # Can be used to add extra config blocks (multiline).
|
||||
# }
|
||||
|
||||
nginx_upstreams: []
|
||||
# - {
|
||||
# name: myapp1,
|
||||
# strategy: "ip_hash", # "least_conn", etc.
|
||||
# servers: {
|
||||
# "srv1.example.com",
|
||||
# "srv2.example.com weight=3",
|
||||
# "srv3.example.com"
|
||||
# }
|
||||
# }
|
||||
nginx_conf_file: nginx.conf.j2
|
||||
setup_www_redirect: false
|
3
playbooks/develop/roles/nginx/handlers/main.yml
Normal file
3
playbooks/develop/roles/nginx/handlers/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: restart nginx
|
||||
service: name=nginx state=restarted
|
23
playbooks/develop/roles/nginx/meta/main.yml
Normal file
23
playbooks/develop/roles/nginx/meta/main.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
author: geerlingguy
|
||||
description: Nginx installation for Linux/UNIX.
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 1.4
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
categories:
|
||||
- development
|
||||
- web
|
41
playbooks/develop/roles/nginx/tasks/main.yml
Normal file
41
playbooks/develop/roles/nginx/tasks/main.yml
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
# Variable setup.
|
||||
- name: Include OS-specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Define nginx_user.
|
||||
set_fact:
|
||||
nginx_user: "{{ __nginx_user }}"
|
||||
when: nginx_user is not defined
|
||||
|
||||
# Setup/install tasks.
|
||||
- include: setup-RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- include: setup-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
# Nginx setup.
|
||||
- name: Copy nginx configuration in place.
|
||||
template:
|
||||
src: "{{ nginx_conf_file }}"
|
||||
dest: /etc/nginx/nginx.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart nginx
|
||||
|
||||
- name: Setup www redirect
|
||||
template:
|
||||
src: ../files/www_redirect.conf
|
||||
dest: /etc/nginx/conf.d/
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart nginx
|
||||
when: setup_www_redirect
|
||||
|
||||
- name: Ensure nginx is started and enabled to start at boot.
|
||||
service: name=nginx state=started enabled=yes
|
||||
|
||||
- include: vhosts.yml
|
6
playbooks/develop/roles/nginx/tasks/setup-Debian.yml
Normal file
6
playbooks/develop/roles/nginx/tasks/setup-Debian.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Ensure nginx is installed.
|
||||
apt:
|
||||
pkg: nginx
|
||||
state: installed
|
||||
default_release: "{{ nginx_default_release }}"
|
11
playbooks/develop/roles/nginx/tasks/setup-RedHat.yml
Normal file
11
playbooks/develop/roles/nginx/tasks/setup-RedHat.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Enable nginx repo.
|
||||
template:
|
||||
src: nginx.repo.j2
|
||||
dest: /etc/yum.repos.d/nginx.repo
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: Ensure nginx is installed.
|
||||
yum: pkg=nginx state=installed enablerepo=nginx
|
22
playbooks/develop/roles/nginx/tasks/vhosts.yml
Normal file
22
playbooks/develop/roles/nginx/tasks/vhosts.yml
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
- name: Remove default nginx vhost config file (if configured).
|
||||
file:
|
||||
path: "{{ nginx_default_vhost_path }}"
|
||||
state: absent
|
||||
when: nginx_remove_default_vhost
|
||||
notify: restart nginx
|
||||
|
||||
- name: Add managed vhost config file (if any vhosts are configured).
|
||||
template:
|
||||
src: vhosts.j2
|
||||
dest: "{{ nginx_vhost_path }}/vhosts.conf"
|
||||
mode: 0644
|
||||
when: nginx_vhosts
|
||||
notify: restart nginx
|
||||
|
||||
- name: Remove managed vhost config file (if no vhosts are configured).
|
||||
file:
|
||||
path: "{{ nginx_vhost_path }}/vhosts.conf"
|
||||
state: absent
|
||||
when: not nginx_vhosts
|
||||
notify: restart nginx
|
51
playbooks/develop/roles/nginx/templates/nginx.conf.j2
Normal file
51
playbooks/develop/roles/nginx/templates/nginx.conf.j2
Normal file
@ -0,0 +1,51 @@
|
||||
user {{ nginx_user }};
|
||||
|
||||
error_log {{ nginx_error_log }};
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
worker_processes {{ nginx_worker_processes }};
|
||||
|
||||
events {
|
||||
worker_connections {{ nginx_worker_connections }};
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
server_names_hash_bucket_size 64;
|
||||
|
||||
client_max_body_size {{ nginx_client_max_body_size }};
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log {{ nginx_access_log }};
|
||||
|
||||
sendfile {{ nginx_sendfile }};
|
||||
tcp_nopush {{ nginx_tcp_nopush }};
|
||||
tcp_nodelay {{ nginx_tcp_nodelay }};
|
||||
|
||||
keepalive_timeout {{ nginx_keepalive_timeout }};
|
||||
keepalive_requests {{ nginx_keepalive_requests }};
|
||||
|
||||
#gzip on;
|
||||
|
||||
{% if nginx_proxy_cache_path %}
|
||||
proxy_cache_path {{ nginx_proxy_cache_path }};
|
||||
{% endif %}
|
||||
|
||||
{% for upstream in nginx_upstreams %}
|
||||
upstream {{ upstream.name }} {
|
||||
{% if upstream.strategy is defined %}
|
||||
{{ upstream.strategy }};
|
||||
{% endif %}
|
||||
{% for server in upstream.servers %}
|
||||
server {{ server }};
|
||||
{% endfor %}
|
||||
}
|
||||
{% endfor %}
|
||||
|
||||
include {{ nginx_vhost_path }}/*;
|
||||
}
|
5
playbooks/develop/roles/nginx/templates/nginx.repo.j2
Normal file
5
playbooks/develop/roles/nginx/templates/nginx.repo.j2
Normal file
@ -0,0 +1,5 @@
|
||||
[nginx]
|
||||
name=nginx repo
|
||||
baseurl=http://nginx.org/packages/centos/{{ ansible_distribution_major_version }}/$basearch/
|
||||
gpgcheck=0
|
||||
enabled=1
|
24
playbooks/develop/roles/nginx/templates/vhosts.j2
Normal file
24
playbooks/develop/roles/nginx/templates/vhosts.j2
Normal file
@ -0,0 +1,24 @@
|
||||
{% for vhost in nginx_vhosts %}
|
||||
server {
|
||||
listen {{ vhost.listen | default('80 default_server') }};
|
||||
server_name {{ vhost.server_name }};
|
||||
|
||||
root {{ vhost.root }};
|
||||
index {{ vhost.index | default('index.html index.htm') }};
|
||||
|
||||
{% if vhost.error_page is defined %}
|
||||
error_page {{ vhost.error_page }};
|
||||
{% endif %}
|
||||
{% if vhost.access_log is defined %}
|
||||
access_log {{ vhost.access_log }};
|
||||
{% endif %}
|
||||
|
||||
{% if vhost.return is defined %}
|
||||
return {{ vhost.return }};
|
||||
{% endif %}
|
||||
|
||||
{% if vhost.extra_parameters is defined %}
|
||||
{{ vhost.extra_parameters }};
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
1
playbooks/develop/roles/nginx/tests/inventory
Normal file
1
playbooks/develop/roles/nginx/tests/inventory
Normal file
@ -0,0 +1 @@
|
||||
localhost
|
5
playbooks/develop/roles/nginx/tests/test.yml
Normal file
5
playbooks/develop/roles/nginx/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- ansible-role-nginx
|
4
playbooks/develop/roles/nginx/vars/Debian.yml
Normal file
4
playbooks/develop/roles/nginx/vars/Debian.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
nginx_vhost_path: /etc/nginx/sites-enabled
|
||||
nginx_default_vhost_path: /etc/nginx/sites-enabled/default
|
||||
__nginx_user: "www-data"
|
4
playbooks/develop/roles/nginx/vars/RedHat.yml
Normal file
4
playbooks/develop/roles/nginx/vars/RedHat.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
nginx_vhost_path: /etc/nginx/conf.d
|
||||
nginx_default_vhost_path: /etc/nginx/conf.d/default.conf
|
||||
__nginx_user: "nginx"
|
38
playbooks/develop/roles/nodejs/tasks/main.yml
Normal file
38
playbooks/develop/roles/nodejs/tasks/main.yml
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
- name: Import Node source RPM key
|
||||
rpm_key:
|
||||
key: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
|
||||
state: present
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Add Node Repo for RedHat
|
||||
yum:
|
||||
name: 'https://rpm.nodesource.com/pub_6.x/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm'
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Install node v6
|
||||
yum: name=nodejs state=present
|
||||
|
||||
- name: Add apt key for node repo
|
||||
apt_key:
|
||||
url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280
|
||||
id: "68576280"
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian' or ansible_distribution == 'Ubuntu'
|
||||
|
||||
- name: Add repo
|
||||
apt_repository:
|
||||
repo: "deb [arch=amd64,i386] https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
register: node_repo
|
||||
when: ansible_os_family == 'Debian' or ansible_distribution == 'Ubuntu'
|
||||
|
||||
- name: Install nodejs 6.x
|
||||
apt:
|
||||
name: nodejs
|
||||
state: present
|
||||
update_cache: yes
|
||||
force: yes
|
||||
when: ansible_os_family == 'Debian' or ansible_distribution == 'Ubuntu'
|
91
playbooks/develop/roles/prerequisites/tasks/main.yml
Normal file
91
playbooks/develop/roles/prerequisites/tasks/main.yml
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
# Prerequisite for centos
|
||||
- name: Install yum packages
|
||||
yum: name={{ item }} state=present
|
||||
with_items:
|
||||
- bzip2-devel
|
||||
- cronie
|
||||
- dnsmasq
|
||||
- freetype-devel
|
||||
- git
|
||||
- htop
|
||||
- lcms2-devel
|
||||
- libjpeg-devel
|
||||
- libtiff-devel
|
||||
- libffi-devel
|
||||
- libwebp-devel
|
||||
- libXext
|
||||
- libXrender
|
||||
- libzip-devel
|
||||
- libffi-devel
|
||||
- ntp
|
||||
- openssl-devel
|
||||
- postfix
|
||||
- python-devel
|
||||
- python-setuptools
|
||||
- python-pip
|
||||
- redis
|
||||
- screen
|
||||
- sudo
|
||||
- supervisor
|
||||
- tcl-devel
|
||||
- tk-devel
|
||||
- vim
|
||||
- which
|
||||
- xorg-x11-fonts-75dpi
|
||||
- xorg-x11-fonts-Type1
|
||||
- zlib-devel
|
||||
- openssl-devel
|
||||
- openldap-devel
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
# Prerequisite for Debian and Ubuntu
|
||||
- name: Install apt packages
|
||||
apt: pkg={{ item }} state=present force=yes
|
||||
with_items:
|
||||
- build-essential
|
||||
- software-properties-common
|
||||
- dnsmasq
|
||||
- fontconfig
|
||||
- git
|
||||
- htop
|
||||
- libcrypto++-dev
|
||||
- libfreetype6-dev
|
||||
- libjpeg8-dev
|
||||
- liblcms2-dev
|
||||
- libssl-dev
|
||||
- libtiff5-dev
|
||||
- libwebp-dev
|
||||
- libxext6
|
||||
- libxrender1
|
||||
- libxslt1-dev
|
||||
- libxslt1.1
|
||||
- libffi-dev
|
||||
- ntp
|
||||
- postfix
|
||||
- python-dev
|
||||
- python-pip
|
||||
- python-tk
|
||||
- redis-server
|
||||
- screen
|
||||
- supervisor
|
||||
- tcl8.6-dev
|
||||
- tk8.6-dev
|
||||
- vim
|
||||
- xfonts-75dpi
|
||||
- xfonts-base
|
||||
- zlib1g-dev
|
||||
- apt-transport-https
|
||||
- libsasl2-dev
|
||||
- libldap2-dev
|
||||
when: ansible_os_family == 'Debian' or ansible_distribution == 'Ubuntu'
|
||||
|
||||
# Prerequisite for MACOS
|
||||
- name: install prequisites
|
||||
homebrew: name={{ item }} state=present
|
||||
with_items:
|
||||
- cmake
|
||||
- redis
|
||||
- mariadb
|
||||
- nodejs
|
||||
when: ansible_distribution == 'MacOSX'
|
3
playbooks/develop/roles/psutil/tasks/main.yml
Normal file
3
playbooks/develop/roles/psutil/tasks/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: Install psutil
|
||||
pip: name=psutil state=latest
|
37
playbooks/develop/roles/wkhtmltopdf/tasks/main.yml
Normal file
37
playbooks/develop/roles/wkhtmltopdf/tasks/main.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
- name: install base fonts
|
||||
yum: name={{ item }} state=present
|
||||
with_items:
|
||||
- libXrender
|
||||
- libXext
|
||||
- xorg-x11-fonts-75dpi
|
||||
- xorg-x11-fonts-Type1
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: install base fonts
|
||||
apt: name={{ item }} state=present force=yes
|
||||
with_items:
|
||||
- libxrender1
|
||||
- libxext6
|
||||
- xfonts-75dpi
|
||||
- xfonts-base
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: download wkthmltox linux
|
||||
get_url: url=https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-{{ "amd64" if ansible_architecture == "x86_64" else "i386"}}.tar.xz dest=/tmp/wkhtmltox.tar.xz
|
||||
|
||||
- name: Creates directory
|
||||
file: path=/tmp/wkhtmltox state=directory
|
||||
|
||||
- name: unarchive wkhtmltopdf
|
||||
unarchive: src=/tmp/wkhtmltox.tar.xz dest=/tmp
|
||||
|
||||
- name: copy to /usr/local/bin
|
||||
copy: src="/tmp/wkhtmltox/bin/wkhtmltopdf" dest="/usr/local/bin/wkhtmltopdf"
|
||||
become: true
|
||||
become_user: root
|
||||
|
||||
- name: make wkhtmltopdf executable
|
||||
file: path=/usr/local/bin/wkhtmltopdf mode="o+x"
|
||||
become: true
|
||||
become_user: root
|
48
playbooks/develop/setup_essentials.yml
Normal file
48
playbooks/develop/setup_essentials.yml
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
- name: Setup Essentials
|
||||
hosts: localhost
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
tasks:
|
||||
- name: Install the 'Development tools' package group (Redhat)
|
||||
yum: name="@Development tools" state=present
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Install EPEL
|
||||
yum: name='epel-release' state=present
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Install libselinux-python
|
||||
yum: name={{ item }} state=present
|
||||
with_items:
|
||||
- python-devel
|
||||
- python-setuptools
|
||||
- python-pip
|
||||
- libselinux-python
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Add dotdeb apt repository key for Debian < 8
|
||||
apt_key:
|
||||
url: http://www.dotdeb.org/dotdeb.gpg
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt')
|
||||
|
||||
- name: Add dotdeb apt repository for redis-server for Debian < 8
|
||||
apt_repository:
|
||||
repo: 'deb http://packages.dotdeb.org wheezy all'
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt')
|
||||
|
||||
- name: Install libselinux-python
|
||||
apt: pkg={{ item }} state=present force=yes
|
||||
with_items:
|
||||
- build-essential
|
||||
- python-dev
|
||||
- python-pip
|
||||
- libselinux-python
|
||||
when: ansible_os_family == 'Debian' or ansible_os_family == 'Ubuntu'
|
@ -1,110 +1,28 @@
|
||||
---
|
||||
- include: setup_essentials.yml
|
||||
|
||||
- hosts: localhost
|
||||
become: yes
|
||||
become_user: root
|
||||
vars:
|
||||
bench_repo_path: "/home/{{ ansible_user_id }}/.bench"
|
||||
bench_path: "/home/{{ ansible_user_id }}/frappe-bench"
|
||||
mysql_config_template: "templates/simple_mariadb_config.cnf"
|
||||
mysql_conf_tpl: ../files/mariadb_config.cnf
|
||||
mysql_conf_dir: /etc/mysql/conf.d/
|
||||
|
||||
roles:
|
||||
- prerequisites
|
||||
- mariadb
|
||||
- wkhtmltopdf
|
||||
- nodejs
|
||||
- psutils
|
||||
tasks:
|
||||
- debug:
|
||||
var: run_travis
|
||||
|
||||
# install pre-requisites
|
||||
- name: install prequisites
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
# basic installs
|
||||
- build-essential
|
||||
- redis-server
|
||||
# setup frappe-bench
|
||||
- include: includes/setup_bench.yml
|
||||
when: not without_bench_setup and not run_travis
|
||||
|
||||
# for mariadb
|
||||
- software-properties-common
|
||||
|
||||
# for wkhtmltopdf
|
||||
- libxrender1
|
||||
- libxext6
|
||||
- xfonts-75dpi
|
||||
- xfonts-base
|
||||
|
||||
# for Pillow
|
||||
- libjpeg8-dev
|
||||
- zlib1g-dev
|
||||
- libfreetype6-dev
|
||||
- liblcms2-dev
|
||||
- libwebp-dev
|
||||
- python-tk
|
||||
|
||||
# Ensure apt-transport-https
|
||||
- apt-transport-https
|
||||
|
||||
# Python LDAP
|
||||
- libsasl2-dev
|
||||
- libldap2-dev
|
||||
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: install pillow prerequisites for Ubuntu < 14.04
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
- libtiff4-dev
|
||||
- tcl8.5-dev
|
||||
- tk8.5-dev
|
||||
when: ansible_distribution_version | version_compare('14.04', 'lt')
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: install pillow prerequisites for Ubuntu >= 14.04
|
||||
apt: pkg={{ item }} state=present
|
||||
with_items:
|
||||
- libtiff5-dev
|
||||
- tcl8.6-dev
|
||||
- tk8.6-dev
|
||||
when: ansible_distribution_version | version_compare('14.04', 'ge')
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Add apt key for node repo
|
||||
apt_key:
|
||||
url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280
|
||||
id: "68576280"
|
||||
state: present
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Add repo
|
||||
apt_repository:
|
||||
repo: "deb [arch=amd64,i386] https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
register: node_repo
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
- name: Install nodejs 6.x
|
||||
apt:
|
||||
name: nodejs
|
||||
state: present
|
||||
update_cache: yes
|
||||
force: yes
|
||||
become: yes
|
||||
become_user: root
|
||||
|
||||
# install MariaDB
|
||||
- include: includes/mariadb_ubuntu.yml
|
||||
|
||||
# install WKHTMLtoPDF
|
||||
- include: includes/wkhtmltopdf.yml
|
||||
|
||||
# setup MariaDB
|
||||
- include: includes/setup_mariadb.yml
|
||||
|
||||
- debug:
|
||||
var: run_travis
|
||||
|
||||
# setup frappe-bench
|
||||
- include: includes/setup_bench.yml
|
||||
when: not without_bench_setup and not run_travis
|
||||
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not production and not run_travis and not without_bench_setup
|
||||
|
||||
# setup development environment
|
||||
- include: includes/setup_dev_env.yml
|
||||
when: not production and not run_travis and not without_bench_setup
|
||||
|
@ -46,6 +46,7 @@ innodb-large-prefix = 1
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
character-set-server = utf8mb4
|
||||
character-set-client-handshake = FALSE
|
||||
max_allowed_packet = 64M
|
||||
|
||||
# LOGGING #
|
||||
log-error = /var/lib/mysql/mysql-error.log
|
||||
|
Loading…
Reference in New Issue
Block a user