-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.yml
79 lines (60 loc) · 2.42 KB
/
install.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
# This playbook sets up etherpad-lite on a server.
# pass the hosts to install to as an extra variable
- hosts: etherpad
user: root
# Uncomment below if not using root
#sudo: yes
tasks:
- name: Install required software packages
apt: pkg=$item state=installed update_cache=yes
with_items:
- git
- mysql-server
- mysql-client
- python-mysqldb
- abiword
- curl
- name: install python-software-properties
apt: pkg=python-software-properties state=installed
- name: add nodejs ppa repository
apt_repository: repo=ppa:chris-lea/node.js
- name: install nodejs
apt: pkg=$item state=installed update_cache=yes
with_items:
- nodejs
- name: add nginx ppa repository
apt_repository: repo=ppa:nginx/stable
- name: install nginx
apt: pkg=nginx state=installed update_cache=yes
- name: create etherpad-lite database
mysql_db: name={{ db_name }} encoding=utf8 state=present
- name: create etherpad-lite mysql user
mysql_user: name={{ db_user }} password={{ db_password }} priv={{ db_name }}.*:ALL state=present
- name: create etherpad-lite user
user: name=etherpad-lite shell=/bin/bash
- name: lock etherpad-lite user's password
command: passwd -l etherpad-lite
- name: check out etherpad-lite code
git: repo=https://github.com/ether/etherpad-lite.git dest=/opt/etherpad-lite version={{ etherpad_version }}
- name: create log directory
file: path=/var/log/etherpad-lite owner=etherpad-lite group=etherpad-lite state=directory
- name: create etherpad-lite startup script
template: src=templates/etc_init_etherpad-lite.j2 dest=/etc/init.d/etherpad-lite mode=0755
notify:
- restart etherpad-lite
- name: configure etherpad-lite
template: src=templates/opt_etherpad-lite_settings.json.j2 dest=/opt/etherpad-lite/settings.json mode=0640 owner=etherpad-lite group=etherpad-lite
notify:
- restart etherpad-lite
- name: update permissions for etherpad-lite directory
file: path=/opt/etherpad-lite owner=etherpad-lite group=etherpad-lite recurse=yes state=directory
- name: configure nginx to forward http traffic to etherpad-lite
template: src=templates/etc_nginx_sites-available_default.j2 dest=/etc/nginx/sites-available/default
notify:
- restart nginx
handlers:
- name: restart etherpad-lite
service: name=etherpad-lite state=restarted
- name: restart nginx
service: name=nginx state=restarted