forked from Azimut-Prod/azimut-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
owncloud.py
63 lines (44 loc) · 1.52 KB
/
owncloud.py
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
from fabric.api import *
from fabric.contrib.files import upload_template
#import time
#import config
import server
@task
def setup_owncloud():
"""Install a new owncloud server"""
execute(server.install_sudo)
execute(server.upgrade)
execute(setup_repo)
execute(install)
execute(configure_locale)
execute(configure_apache)
@task
def setup_repo():
"""Setup the owncloud repository"""
sudo("echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list")
sudo("wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key -O - | apt-key add -")
sudo("apt-get -y update")
@task
def install():
"""Install the owncloud package and his depencencies"""
sudo("apt-get -y install apache2 php5 php5-gd php-xml-parser php5-intl php5-mysql smbclient curl libcurl3 php5-curl owncloud")
@task
def configure_locale():
"""Configure locales for VM without"""
sudo("echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen")
sudo("locale-gen")
@task
def configure_apache():
"""Configure apache to work with owncloud"""
# Disable default site
sudo("a2dissite 000-default")
# Enable needed apache modules
sudo("a2enmod rewrite")
sudo("a2enmod headers")
sudo("a2enmod ssl")
# Copy config
put('files/owncloud/owncloud.conf', '/etc/apache2/sites-available/')
# Enable site
sudo("a2ensite owncloud.conf")
# Restart apache
sudo("service apache2 restart")