Skip to content

Commit d42e457

Browse files
committed
Added owncloud, new config element for gestion server
1 parent 4fca433 commit d42e457

File tree

5 files changed

+51
-34
lines changed

5 files changed

+51
-34
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To be used with azimut-gestion tool !
99

1010
Copy `config.py.dist` to `config.py` and edit values if needed.
1111

12-
Some scripts except configuration files (for vim, zsh, etc.), who should be in the `AZIMUT_CONFIG` folder. You can find our files (https://github.com/Azimut-Prod/azimut-config)[here].
12+
Some scripts except configuration files (for vim, zsh, etc.), who should be in the `AZIMUT_CONFIG` folder. You can find our files [here](https://github.com/Azimut-Prod/azimut-config).
1313

1414
## Scripts available
1515

config.py.dist

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
SSH_KEY = '~/.ssh/id_rsa'
22

3-
AZIMUT_CONFIG = '../azimut-config/'
3+
AZIMUT_CONFIG = '../azimut-config/'
4+
5+
GESTION_ADDRESS = '<gestion_adresse>'

files/updateKeys.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
SERVER='%(server)s'
44
USERS="%(users)s"
55

6-
baseURL='http://XXX/keymanager/servers/getKeys/'
6+
baseURL='http://%(gestion_adresse)s/keymanager/servers/getKeys/'
77

88
for usr in $USERS; do
99

owncloud.py

+35-27
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,60 @@
44
#import time
55
#import config
66

7+
import server
8+
9+
710
@task
811
def setup_owncloud():
9-
"""Install a new owncloud server"""
12+
"""Install a new owncloud server"""
13+
14+
execute(server.install_sudo)
15+
execute(server.upgrade)
16+
execute(setup_repo)
17+
execute(install)
18+
execute(configure_locale)
19+
execute(configure_apache)
1020

11-
execute(setup_repo)
12-
execute(install)
13-
execute(configure_locale)
14-
execute(configure_apache)
1521

1622
@task
1723
def setup_repo():
18-
"""Setup the owncloud repository"""
24+
"""Setup the owncloud repository"""
25+
26+
sudo("echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list")
27+
sudo("wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key -O - | apt-key add -")
28+
sudo("apt-get -y update")
1929

20-
sudo("echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list")
21-
sudo("wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key -O - | apt-key add -")
22-
sudo("apt-get -y update")
2330

2431
@task
2532
def install():
26-
"""Install the owncloud package and his depencencies"""
27-
sudo("apt-get -y install apache2 php5 php5-gd php-xml-parser php5-intl php5-mysql smbclient curl libcurl3 php5-curl owncloud")
33+
"""Install the owncloud package and his depencencies"""
34+
sudo("apt-get -y install apache2 php5 php5-gd php-xml-parser php5-intl php5-mysql smbclient curl libcurl3 php5-curl owncloud")
2835

2936

3037
@task
3138
def configure_locale():
32-
"""Configure locales for VM without"""
33-
sudo("echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen")
34-
sudo("locale-gen")
39+
"""Configure locales for VM without"""
40+
sudo("echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen")
41+
sudo("locale-gen")
42+
3543

3644
@task
3745
def configure_apache():
38-
"""Configure apache to work with owncloud"""
46+
"""Configure apache to work with owncloud"""
3947

40-
# Disable default site
41-
sudo("a2dissite 000-default")
48+
# Disable default site
49+
sudo("a2dissite 000-default")
4250

43-
# Enable needed apache modules
44-
sudo("a2enmod rewrite")
45-
sudo("a2enmod headers")
46-
sudo("a2enmod ssl")
51+
# Enable needed apache modules
52+
sudo("a2enmod rewrite")
53+
sudo("a2enmod headers")
54+
sudo("a2enmod ssl")
4755

48-
# Copy config
49-
put('files/owncloud/owncloud.conf', '/etc/apache2/sites-available/')
56+
# Copy config
57+
put('files/owncloud/owncloud.conf', '/etc/apache2/sites-available/')
5058

51-
# Enable site
52-
sudo("a2ensite owncloud.conf")
59+
# Enable site
60+
sudo("a2ensite owncloud.conf")
5361

54-
# Restart apache
55-
sudo("service apache2 restart")
62+
# Restart apache
63+
sudo("service apache2 restart")

server.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def upgrade():
1818
sudo("apt-get upgrade -y")
1919
sudo("apt-get dist-upgrade -y")
2020

21+
2122
@task
2223
def install_sudo():
2324
"""Install the sudo programm. Need to be runned with root"""
@@ -35,6 +36,7 @@ def reboot():
3536
x -= 1
3637
sudo("reboot")
3738

39+
3840
@task
3941
def shutdown():
4042
"""Shutdown a machine"""
@@ -57,6 +59,7 @@ def copy_key_manager():
5759
upload_template('files/updateKeys.sh', '/root/updateKeys.sh', {
5860
'server': env.keymanagerName,
5961
'users': env.keyManagerUsers,
62+
'gestion_adresse': config.GESTION_ADDRESS,
6063
}, use_sudo=True)
6164

6265
sudo("chmod +x /root/updateKeys.sh")
@@ -67,7 +70,7 @@ def cron_key_manager():
6770
"""Install the crontab for the keymanagement"""
6871
sudo('touch /tmp/crondump')
6972
with settings(warn_only=True):
70-
sudo('crontab -l > /tmp/crondump')
73+
sudo('crontab -l > /tmp/crondump')
7174
sudo('echo " 42 * * * * /root/updateKeys.sh" >> /tmp/crondump')
7275
sudo('crontab /tmp/crondump')
7376

@@ -96,6 +99,7 @@ def copy_config():
9699
put(config.AZIMUT_CONFIG + '/.screenrc', '~')
97100
put(config.AZIMUT_CONFIG + '/.zshrc', '~')
98101

102+
99103
@task
100104
def copy_user_config():
101105
"""Copy the config for a user [$AG:NeedUser]"""
@@ -120,19 +124,22 @@ def switch_shell_to_zsh():
120124
"""Change the shell to ZSH"""
121125
run('chsh -s /bin/zsh')
122126

127+
123128
@task
124129
def install_rsync():
125130
"""Install rsync"""
126131
sudo("apt-get install rsync")
127132

133+
128134
@task
129135
def add_gestion_for_self_vms():
130-
"""Add a host for it2d vm so they can access the server [$AG:NeedGestion]"""
136+
"""Add a host for gestion vm so they can access the server even if on the same server [$AG:NeedGestion]"""
131137

132138
if not hasattr(env, 'gestion_ip') or env.gestion_ip == '':
133-
return
139+
return
134140
sudo('echo "' + env.gestion_ip + ' ' + env.gestion_name + '" >> /etc/hosts')
135-
141+
142+
136143
@task
137144
def setup():
138145
"""Setup a new server [$AG:NeedKM][$AG:NeedGestion]"""

0 commit comments

Comments
 (0)