Commit 405b4968 authored by Leonard Marschke's avatar Leonard Marschke

configure try1

parent 9dbe837c
......@@ -79,7 +79,7 @@ def installMemcached():
sudo("sed -i -e 's/^-l.*$/-l 192.168.3.10/' /etc/memcached.conf")
sudo("systemctl restart memcached")
identityServiceEnvs = {
identityServiceEnvsAdmin = {
"OS_USERNAME": "admin",
"OS_PASSWORD": "lmm123",
"OS_PROJECT_NAME": "admin",
......@@ -87,6 +87,18 @@ identityServiceEnvs = {
"OS_PROJECT_DOMAIN_NAME": "Default",
"OS_AUTH_URL": "http://controller:35357/v3",
"OS_IDENTITY_API_VERSION": "3",
"OS_IMAGES_API_VERSION": "2",
}
identityServiceEnvsDemo = {
"OS_USERNAME": "demo",
"OS_PASSWORD": "lmm123",
"OS_PROJECT_NAME": "demo",
"OS_USER_DOMAIN_NAME": "Default",
"OS_PROJECT_DOMAIN_NAME": "Default",
"OS_AUTH_URL": "http://controller:5000/v3",
"OS_IDENTITY_API_VERSION": "3",
"OS_IMAGES_API_VERSION": "2",
}
@roles('controller')
......@@ -95,7 +107,7 @@ def setupIdentityService():
sudo("cat /tmp/identityServiceSetup.sql | mysql -u root -plmm123")
sudo("apt-get install -y keystone")
sudo("sed -i -e 's|^connection.*$|connection = mysql+pymysql://keystone:lmm123@controller/keystone|' /etc/keystone/keystone.conf")
sudo("sed -i -e 's|^provider.*$|provider = fernet|' /etc/keystone/keystone.conf")
sudo("sed -i -e 's|^#provider = uuid|provider = fernet|' /etc/keystone/keystone.conf")
sudo("keystone-manage db_sync", user="keystone")
sudo("keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone")
sudo("keystone-manage credential_setup --keystone-user keystone --keystone-group keystone")
......@@ -108,6 +120,65 @@ def setupIdentityService():
sudo("systemctl restart apache2")
sudo("rm -f /var/lib/keystone/keystone.db")
@roles('controller')
def createDemoProjectUser():
with shell_env(**identityServiceEnvsAdmin):
run("openstack project create --domain default --description 'Service Project' service")
run("openstack project create --domain default --description 'Demo Project' demo")
run("openstack user create --domain default --password lmm123 demo")
run("openstack role create user")
run("openstack role add --project demo --user demo user")
@roles('controller')
def installGlance():
put("imageServiceSetup.sql", "/tmp/imageServiceSetup.sql")
sudo("cat /tmp/imageServiceSetup.sql | mysql -u root -plmm123")
with shell_env(**identityServiceEnvsAdmin):
sudo("openstack user create --domain default --password lmm123 glance")
sudo("openstack role add --project service --user glance admin")
sudo("openstack service create --name glance --description 'OpenStack Image' image")
sudo("openstack endpoint create --region RegionOne image public http://controller:9292")
sudo("openstack endpoint create --region RegionOne image internal http://controller:9292")
sudo("openstack endpoint create --region RegionOne image admin http://controller:9292")
sudo("apt-get install -y glance")
sudo("sed -i -e 's|^connection.*$|connection = mysql+pymysql://glance:lmm123@controller/glance|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^#auth_uri.*$|auth_uri = http://controller:5000|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^#auth_url.*$|auth_url = http://controller:35357|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^#memcached_servers.*$|memcached_servers = controller:11211|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^#auth_type.*$|auth_type = password|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^project_domain_name.*$|project_domain_name = Default|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^user_domain_name.*$|user_domain_name = Default|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^project_name.*$|project_name = service|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^username.*$|username = glance|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^password.*$|password = lmm123|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^flavor.*$|flavor = keystone|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^stores.*$|stores = file,http|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^default_store.*$|default_store = file|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^filesystem_store_datadir.*$|filesystem_store_datadir = /var/lib/glance/images|' /etc/glance/glance-api.conf")
sudo("sed -i -e 's|^connection.*$|connection = mysql+pymysql://glance:lmm123@controller/glance|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^connection.*$|connection = mysql+pymysql://glance:lmm123@controller/glance|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^#auth_uri.*$|auth_uri = http://controller:5000|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^auth_url.*$|auth_url = http://controller:35357|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^memcached_servers.*$|memcached_servers = controller:11211|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^auth_type.*$|auth_type = password|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^project_domain_name.*$|project_domain_name = Default|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^user_domain_name.*$|user_domain_name = Default|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^project_name.*$|project_name = service|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^username.*$|username = glance|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^password.*$|password = lmm123|' /etc/glance/glance-registry.conf")
sudo("sed -i -e 's|^flavor.*$|flavor = keystone|' /etc/glance/glance-registry.conf")
sudo("glance-manage db_sync", user="glance")
sudo("systemctl restart glance-registry")
sudo("systemctl restart glance-api")
......
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment