Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lisa Casino
slapos
Commits
44f5ebe2
Commit
44f5ebe2
authored
Sep 05, 2013
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automate Openstack Master deployment
parent
10b2e4c2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
28 deletions
+179
-28
software/openstack/instance-compute.cfg
software/openstack/instance-compute.cfg
+1
-0
software/openstack/instance-main.cfg
software/openstack/instance-main.cfg
+65
-6
software/openstack/software.cfg
software/openstack/software.cfg
+9
-4
software/openstack/templates/configure.sh.in
software/openstack/templates/configure.sh.in
+4
-2
software/openstack/templates/openstack-install.sh.in
software/openstack/templates/openstack-install.sh.in
+62
-0
software/openstack/templates/ssh-configure.py.in
software/openstack/templates/ssh-configure.py.in
+38
-16
No files found.
software/openstack/instance-compute.cfg
View file @
44f5ebe2
...
@@ -137,6 +137,7 @@ nova-result = $${directory:log}
...
@@ -137,6 +137,7 @@ nova-result = $${directory:log}
ssh-check-script = $${ssh-port-check:path}
ssh-check-script = $${ssh-port-check:path}
python_path = ${buildout:executable}
python_path = ${buildout:executable}
eggs-dir = ${buildout:eggs-directory}
eggs-dir = ${buildout:eggs-directory}
instance = compute
[nova-configure]
[nova-configure]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
...
...
software/openstack/instance-main.cfg
View file @
44f5ebe2
...
@@ -10,7 +10,8 @@ parts =
...
@@ -10,7 +10,8 @@ parts =
websockify-sighandler
websockify-sighandler
kvm-promise
kvm-promise
novnc-promise
novnc-promise
openstack-frontend-promise
nova-install
# openstack-frontend-promise
publish-kvm-connection-information
publish-kvm-connection-information
eggs-directory = ${buildout:eggs-directory}
eggs-directory = ${buildout:eggs-directory}
...
@@ -29,6 +30,8 @@ promises = $${:etc}/promise
...
@@ -29,6 +30,8 @@ promises = $${:etc}/promise
novnc-conf = $${:etc}/novnc
novnc-conf = $${:etc}/novnc
run = $${:var}/run
run = $${:var}/run
ca-dir = $${:srv}/ssl
ca-dir = $${:srv}/ssl
nova = $${:bin}/nova
log = $${:var}/log
[create-mac]
[create-mac]
recipe = slapos.cookbook:generate.mac
recipe = slapos.cookbook:generate.mac
...
@@ -39,6 +42,11 @@ recipe = slapos.cookbook:generate.password
...
@@ -39,6 +42,11 @@ recipe = slapos.cookbook:generate.password
storage-path = $${directory:srv}/passwd
storage-path = $${directory:srv}/passwd
bytes = 8
bytes = 8
[master-passwd]
recipe = slapos.cookbook:generate.password
storage-path = $${directory:srv}/openstack.passwd
bytes = 8
[kvm-instance]
[kvm-instance]
recipe = slapos.cookbook:kvm
recipe = slapos.cookbook:kvm
vnc-passwd = $${gen-passwd:passwd}
vnc-passwd = $${gen-passwd:passwd}
...
@@ -75,7 +83,7 @@ controller-path = $${directory:scripts}/kvm_controller
...
@@ -75,7 +83,7 @@ controller-path = $${directory:scripts}/kvm_controller
ssh-port = 22222
ssh-port = 22222
use-tap = False
use-tap = False
nat-rules = 22:$${:ssh-port}
, 80:8080, 443:4443, 5000:5000, 6080:6080, 6082:6082, 3333:3333, 9292:9292, 3306:3306,
35357:35357
nat-rules = 22:$${:ssh-port}
80:$${tunnel-http:port} 443:$${tunnel-http:port-https} 5000:5000 6080:$${tunnel-http:port-vnc} 6082:6082 3333:3333 9292:9292 3306:3306
35357:35357
6tunnel-wrapper-path = $${directory:services}/6tunnel
6tunnel-wrapper-path = $${directory:services}/6tunnel
virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url}
virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url}
...
@@ -89,8 +97,8 @@ qemu-img-path = ${kvm:location}/bin/qemu-img
...
@@ -89,8 +97,8 @@ qemu-img-path = ${kvm:location}/bin/qemu-img
[kvm-promise]
[kvm-promise]
recipe = slapos.cookbook:check_port_listening
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/vnc_promise
path = $${directory:promises}/vnc_promise
hostname = $${kvm-instance:vnc
_
ip}
hostname = $${kvm-instance:vnc
-
ip}
port = $${kvm-instance:vnc
_
port}
port = $${kvm-instance:vnc
-
port}
[tunnel-ipv6-base]
[tunnel-ipv6-base]
recipe = slapos.cookbook:ipv6toipv4
recipe = slapos.cookbook:ipv6toipv4
...
@@ -99,12 +107,57 @@ ipv4 = $${slap-network-information:local-ipv4}
...
@@ -99,12 +107,57 @@ ipv4 = $${slap-network-information:local-ipv4}
shell-path = ${dash:location}/bin/dash
shell-path = ${dash:location}/bin/dash
6tunnel-path = ${6tunnel:location}/bin/6tunnel
6tunnel-path = ${6tunnel:location}/bin/6tunnel
[install-script]
recipe = slapos.recipe.template
url = ${openstack-install:location}/${openstack-install:filename}
output = $${directory:nova}/openstack_install.sh
mode = 0700
nova-url = https://github.com/openstack-dev/devstack.git
slap-ipv4 = $${slap-network-information:local-ipv4}
nova-passwd = $${master-passwd:passwd}
nova-user = $${slap-parameter:system-user}
vnc-url = $${request-openstack-vnc-frontend:connection-url}
[nova-conf-run]
recipe = slapos.recipe.template
url = ${compute-script-run:location}/${compute-script-run:filename}
output = $${directory:nova}/nova_configure.py
mode = 0700
host-ip = $${tunnel-ipv6-ssh:ipv6}
ssh-port = $${tunnel-ipv6-ssh:ipv6-port}
system-user = $${slap-parameter:system-user}
system-passwd = $${slap-parameter:system-passwd}
nova-configure = $${install-script:output}
nova-result = $${directory:log}
python_path = ${buildout:executable}
eggs-dir = ${buildout:eggs-directory}
instance = manage
[nova-install]
recipe = slapos.cookbook:wrapper
command-line = $${nova-conf-run:output}
wrapper-path = $${directory:scripts}/openstack-install
######################################################################
### PREDEFINED PORT AND HOST FOR SSH ACCESS TO OPENSTACK COMPUTER ####
[tunnel-ipv6-ssh]
[tunnel-ipv6-ssh]
ipv6-port = $${kvm-instance:ssh-port}
ipv6-port = $${kvm-instance:ssh-port}
ipv4-port = $${kvm-instance:ssh-port}
ipv4-port = $${kvm-instance:ssh-port}
ipv6 = $${slap-network-information:global-ipv6}
ipv6 = $${slap-network-information:global-ipv6}
ipv4 = $${slap-network-information:local-ipv4}
ipv4 = $${slap-network-information:local-ipv4}
##########################################################
### PREDEFINED PORT AND HOST FOR NOVA HORIZON SERVICE ####
[tunnel-http]
host = $${slap-network-information:global-ipv6}
port = 8080
port-https = 4443
port-vnc = 6080
##########################################################
[novnc-instance]
[novnc-instance]
recipe = slapos.cookbook:novnc
recipe = slapos.cookbook:novnc
path = $${ca-novnc:executable}
path = $${ca-novnc:executable}
...
@@ -192,7 +245,7 @@ software-type = $${slap-parameter:frontend-software-type}
...
@@ -192,7 +245,7 @@ software-type = $${slap-parameter:frontend-software-type}
slave = true
slave = true
config = host port
config = host port
config-host = $${slap-network-information:global-ipv6}
config-host = $${slap-network-information:global-ipv6}
config-port = $${tunnel-
ipv6-novnc:ipv6-port
}
config-port = $${tunnel-
http:port-vnc
}
return = url resource port domainname
return = url resource port domainname
sla = instance_guid
sla = instance_guid
sla-instance_guid = $${slap-parameter:frontend-instance-guid}
sla-instance_guid = $${slap-parameter:frontend-instance-guid}
...
@@ -205,7 +258,7 @@ name = Frontend OpenStack
...
@@ -205,7 +258,7 @@ name = Frontend OpenStack
software-url = $${slap-parameter:frontend-software-url}
software-url = $${slap-parameter:frontend-software-url}
slave = true
slave = true
config = url custom_domain
config = url custom_domain
config-url = http://[$${tunnel-
ipv6-http:ipv6}]:$${tunnel-ipv6-http:ipv6-
port}/
config-url = http://[$${tunnel-
http:host}]:$${tunnel-http:
port}/
return = site_url
return = site_url
config-custom_domain = $${slap-parameter:domain}
config-custom_domain = $${slap-parameter:domain}
...
@@ -215,6 +268,7 @@ vnc-backend-url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_au
...
@@ -215,6 +268,7 @@ vnc-backend-url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_au
vnc-url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}&password=$${kvm-instance:vnc-passwd}
vnc-url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}&password=$${kvm-instance:vnc-passwd}
ssh = ssh stack@$${tunnel-ipv6-ssh:ipv6} -p $${tunnel-ipv6-ssh:ipv6-port}
ssh = ssh stack@$${tunnel-ipv6-ssh:ipv6} -p $${tunnel-ipv6-ssh:ipv6-port}
ssh-defaul-passwd = openstack
ssh-defaul-passwd = openstack
openstack-services-passwd = $${master-passwd:passwd}
openstack-url = $${request-openstack-frontend:connection-site_url}
openstack-url = $${request-openstack-frontend:connection-site_url}
openstack-vnc = $${request-openstack-vnc-frontend:connection-url}/vnc_auto.html
openstack-vnc = $${request-openstack-vnc-frontend:connection-url}/vnc_auto.html
openstack-services-host = $${slap-network-information:global-ipv6}
openstack-services-host = $${slap-network-information:global-ipv6}
...
@@ -246,5 +300,10 @@ nbd-port = 1024
...
@@ -246,5 +300,10 @@ nbd-port = 1024
nbd-host = 2001:470:1f14:169:dd6b:3f84:9205:c750
nbd-host = 2001:470:1f14:169:dd6b:3f84:9205:c750
nbd2-port = 1024
nbd2-port = 1024
nbd2-host =
nbd2-host =
system-user = stack
system-passwd = openstack
domain =
domain =
virtual-hard-drive-url =
virtual-hard-drive-md5sum =
\ No newline at end of file
software/openstack/software.cfg
View file @
44f5ebe2
...
@@ -36,14 +36,14 @@ eggs =
...
@@ -36,14 +36,14 @@ eggs =
[template-openstack-main]
[template-openstack-main]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-main.cfg
url = ${:_profile_base_location_}/instance-main.cfg
md5sum =
1bf5ebf952369b4a99e82b51b5f08f71
md5sum =
52a8f4afb5ad06f29c34253b1cda07f8
output = ${buildout:directory}/template-openstack-main.cfg
output = ${buildout:directory}/template-openstack-main.cfg
mode = 0644
mode = 0644
[template-openstack-compute]
[template-openstack-compute]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-compute.cfg
url = ${:_profile_base_location_}/instance-compute.cfg
md5sum = 4
fe2871f561b96cc458fe3f42eb9b442
md5sum = 4
503b60e8ca90bdaeb014792bbab190c
output = ${buildout:directory}/template-openstack-compute.cfg
output = ${buildout:directory}/template-openstack-compute.cfg
mode = 0644
mode = 0644
...
@@ -63,12 +63,17 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
...
@@ -63,12 +63,17 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
[compute-script]
[compute-script]
<= template-download
<= template-download
filename = configure.sh.in
filename = configure.sh.in
md5sum =
2b0b0be2738ed07716a34ccc7c7135f
f
md5sum =
ffabb8448fda7f95e47831dad133659
f
[compute-script-run]
[compute-script-run]
<= template-download
<= template-download
filename = ssh-configure.py.in
filename = ssh-configure.py.in
md5sum = bcbeabd3cd8f19d71ec9209d9edfbbf8
md5sum = 18d2a7b3a8770726f061c8f2f4f9123b
[openstack-install]
<= template-download
filename = openstack-install.sh.in
md5sum = 674b2e2b7e5c5364c18ed63c2fa3ee98
[slapos.cookbook-repository]
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
recipe = slapos.recipe.build:gitclone
...
...
software/openstack/templates/configure.sh.in
View file @
44f5ebe2
...
@@ -48,11 +48,11 @@ bridge_stp off
...
@@ -48,11 +48,11 @@ bridge_stp off
bridge_fd 0
bridge_fd 0
EOF
EOF
BRCTL_EXEC
=
`
which brctl
`
if
[
-z
"
$BRCTL_EXEC
"
-o
!
-x
"
$BRCTL_EXEC
"
]
;
then
if
[
-z
"
$BRCTL_EXEC
"
-o
!
-x
"
$BRCTL_EXEC
"
]
;
then
apt-get
install
-y
bridge-utils
;
apt-get
install
-y
bridge-utils
;
BRCTL_EXEC
=
`
which brctl
`
fi
fi
BRCTL_EXEC
=
`
which brctl
`
$BRCTL_EXEC
addbr br100
$BRCTL_EXEC
addbr br100
...
@@ -72,8 +72,10 @@ apt-get install -y python-libvirt
...
@@ -72,8 +72,10 @@ apt-get install -y python-libvirt
apt-get
install
-y
libxml2-dev libxslt-dev
apt-get
install
-y
libxml2-dev libxslt-dev
apt-get
install
-y
python-lxml
apt-get
install
-y
python-lxml
GIT_EXEC
=
`
which git
`
if
[
-z
"
$GIT_EXEC
"
-o
!
-x
"
$GIT_EXEC
"
]
;
then
if
[
-z
"
$GIT_EXEC
"
-o
!
-x
"
$GIT_EXEC
"
]
;
then
apt-get
install
-y
git
;
apt-get
install
-y
git
;
GIT_EXEC
=
`
which git
`
fi
fi
GIT_EXEC
=
`
which git
`
GIT_EXEC
=
`
which git
`
...
...
software/openstack/templates/openstack-install.sh.in
0 → 100644
View file @
44f5ebe2
#!/usr/bin/env bash
#configure.sh: Should automate Openstack installation with all needed packages.
REPO_URL
=
"
${
:nova-url
}
"
NOVA_CONFIG
=
"/etc/nova/nova.conf"
BASE_DIR
=
"/opt/openstack"
INSTALL_LOG
=
"/opt/openstack/log"
NOVA_PASSWD
=
"
${
:nova-passwd
}
"
NOVA_USER
=
"
${
:nova-user
}
"
IPv4
=
`
ip addr show eth0 |
grep
'inet '
|
awk
'{print $2}'
|
cut
-d
/
-f1
`
if
[
-z
"
$IPv4
"
]
;
then
IPv4
=
"127.0.0.1"
fi
if
[
-z
"
$GIT_EXEC
"
-o
!
-x
"
$GIT_EXEC
"
]
;
then
apt-get
install
-y
git
;
fi
GIT_EXEC
=
`
which git
`
$GIT_EXEC
clone
$REPO_URL
$BASE_DIR
;
mkdir
-p
$INSTALL_LOG
cp
-f
$BASE_DIR
/samples/local.sh
$BASE_DIR
/local.sh
cat
>
$BASE_DIR
/localrc
<<
EOF
DATABASE_PASSWORD=
$NOVA_PASSWD
RABBIT_PASSWORD=
$NOVA_PASSWD
SERVICE_TOKEN=
$NOVA_PASSWD
SERVICE_PASSWORD=
$NOVA_PASSWD
ADMIN_PASSWORD=
$NOVA_PASSWD
SERVICE_HOST=
$IPv4
HOST_IP=
$IPv4
LOGFILE=
$INSTALL_LOG
/stack.sh.log
LOGDAYS=7
# Nova Network Configuration
PUBLIC_INTERFACE=br100
FLAT_INTERFACE=eth0
FLAT_NETWORK_BRIDGE_DEFAULT=br100
VLAN_INTERFACE = eth0
ISCSI_IP_PREFIX=192.168.100
FIXED_RANGE=
NET_MAN=FlatDHCPManager
MULTI_HOST=1
EOF
chmod
600
$BASE_DIR
/localrc
#Install Openstack...
chown
-R
$NOVA_USER
:
$BASE_DIR
#sudo dpkg --configure -a
cd
$BASE_DIR
;
./stack.sh
cd
$BASE_DIR
;
./local.sh
exit
0
software/openstack/templates/ssh-configure.py.in
View file @
44f5ebe2
...
@@ -17,7 +17,6 @@ sys.path[0:0] = pythonPath
...
@@ -17,7 +17,6 @@ sys.path[0:0] = pythonPath
import paramiko
import paramiko
check_ssh_args = ['${:ssh-check-script}']
password = '${:system-passwd}'
password = '${:system-passwd}'
username = '${:system-user}'
username = '${:system-user}'
port = ${:ssh-port}
port = ${:ssh-port}
...
@@ -25,6 +24,7 @@ hostname = '${:host-ip}'
...
@@ -25,6 +24,7 @@ hostname = '${:host-ip}'
ssh_run = os.path.join('${:nova-result}', 'nova-configure.log')
ssh_run = os.path.join('${:nova-result}', 'nova-configure.log')
ssh_check = os.path.join('${:nova-result}', 'ssh_check.log')
ssh_check = os.path.join('${:nova-result}', 'ssh_check.log')
nova_configure = '${:nova-configure}'
nova_configure = '${:nova-configure}'
instance = '${:instance}'.strip() #Type: manage or compute
def getClient():
def getClient():
try:
try:
...
@@ -38,6 +38,38 @@ def getClient():
...
@@ -38,6 +38,38 @@ def getClient():
print "Could not connect to host... Will retry after a few minutes"
print "Could not connect to host... Will retry after a few minutes"
return None
return None
def installCompute():
#Install nova components and services
print "Installing nova..."
install_command = "echo %s | sudo -S /bin/sh configure.sh" % password
stdin, stdout, stderr = client.exec_command(install_command)
with open(ssh_run, 'a') as output:
output.write(stdout.read())
#Check nova service status
print "Checking nova service status..."
nova_command = 'echo %s | sudo -S /etc/init.d/nova-compute status' % password
stdin, stdout, stderr = client.exec_command(nova_command)
with open(ssh_check, 'a') as output:
output.write(stdout.read())
def installManage():
#Install nova components and services
print "Downloading and installing Openstack on computer..."
install_command = "echo %s | sudo -S /bin/sh configure.sh" % password
stdin, stdout, stderr = client.exec_command(install_command)
with open(ssh_run, 'a') as output:
output.write(stdout.read())
#Check installation status
#Check nova service status
print "Checking nova service status..."
nova_command = 'nova-manage service list'
stdin, stdout, stderr = client.exec_command(nova_command)
with open(ssh_check, 'a') as output:
output.write(stdout.read())
if __name__ == '__main__':
if __name__ == '__main__':
client = None
client = None
while not client:
while not client:
...
@@ -47,22 +79,12 @@ if __name__ == '__main__':
...
@@ -47,22 +79,12 @@ if __name__ == '__main__':
#Write file configure.sh to use.
#Write file configure.sh to use.
sftp = client.open_sftp()
sftp = client.open_sftp()
result = sftp.put(nova_configure, 'configure.sh' )
result = sftp.put(nova_configure, 'configure.sh' )
print 'Nova configur
e
copied successfully! File size: %s' % result.st_size
print 'Nova configur
ation file has been
copied successfully! File size: %s' % result.st_size
sftp.close()
sftp.close()
if instance == "manage":
#Install nova components and services
installManage()
print "Installing nova..."
elif instance == "compute":
install_command = "echo %s | sudo -S /bin/sh configure.sh" % password
installCompute()
stdin, stdout, stderr = client.exec_command(install_command)
with open(ssh_run, 'a') as output:
output.write(stdout.read())
#Check nova service status
print "Checking nova service status..."
nova_command = 'echo %s | sudo -S /etc/init.d/nova-compute status' % password
stdin, stdout, stderr = client.exec_command(nova_command)
with open(ssh_check, 'a') as output:
output.write(stdout.read())
client.close()
client.close()
except Exception, e:
except Exception, e:
print '*** Caught exception: %s: %s' % (e.__class__, e)
print '*** Caught exception: %s: %s' % (e.__class__, e)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment