forked from lbthomsen/subutai-blueprint-nextcloud
/
site.yml
102 lines (87 loc) · 2.57 KB
/
site.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Ansible Playbook for Subutai Nextcloud blueprint
---
- hosts: nc
remote_user: root
tasks:
- name: Disable dpkg fsync
raw: test -e /etc/dpkg/dpkg.cfg.d/unsafe-io || echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/unsafe-io
- name: Upgrade debian
apt:
update_cache: true
upgrade: true
- name: Install required debs
apt:
name: "{{ item }}"
state: present
allow_unauthenticated: yes
with_items:
- sudo
- php7.0
- php7.0-cgi
- php7.0-mysql
- php7.0-zip
- php7.0-dom
- php7.0-xmlwriter
- php7.0-xmlreader
- php7.0-xml
- php7.0-mbstring
- php7.0-gd
- php7.0-curl
- apache2
- libapache2-mod-php7.0
- unzip
- mariadb-server
- python-mysqldb
- name: Create database
mysql_db:
name: "nextcloud"
state: present
encoding: utf8
- name: Create database user
mysql_user:
name: "nextcloud"
password: "nextcloud"
priv: "nextcloud.*:ALL"
- name: Download and unzip nextcloud
unarchive:
src: "https://download.nextcloud.com/server/releases/nextcloud-15.0.0.zip"
dest: "/var/www"
remote_src: yes
validate_certs: no
- name: Change file ownership
file:
path: /var/www/nextcloud
recurse: yes
owner: www-data
group: www-data
- name: Create apache config
template:
src: files/nextcloud.conf
dest: /etc/apache2/sites-available
- name: Disable default apache config
file:
path: /etc/apache2/sites-enabled/000-default.conf
state: absent
- name: Enable nextcloud apache config
file:
src: /etc/apache2/sites-available/nextcloud.conf
dest: /etc/apache2/sites-enabled/nextcloud.conf
state: link
- name: Restart apache
service:
name: apache2
state: restarted
- name: Configure nextcloud
shell: php occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "nextcloud" --database-pass "nextcloud" --admin-user "{{ admin_user }}" --admin-pass "{{ admin_pwd }}"
args:
chdir: /var/www/nextcloud
become: yes
become_user: www-data
- name: Add domain to config
lineinfile:
path: /var/www/nextcloud/config/config.php
insertafter: '^.*0 =>'
line: " 1 => '{{ domain_name }}',"
owner: www-data
group: www-data
# vim: ts=2 et nowrap autoindent