diff options
Diffstat (limited to 'openstack/usr/share')
4 files changed, 93 insertions, 13 deletions
diff --git a/openstack/usr/share/openstack/openstack-cinder-setup b/openstack/usr/share/openstack/openstack-cinder-setup index f97853f6..ade53e92 100644 --- a/openstack/usr/share/openstack/openstack-cinder-setup +++ b/openstack/usr/share/openstack/openstack-cinder-setup @@ -66,18 +66,30 @@ if [ ! -d /var/log/cinder ]; then chown -R cinder:cinder /var/log/cinder fi -# Setup the cinder database -if [ ! -e /var/lib/cinder/cinder.sqlite ]; then - chown -R cinder:cinder /var/lib/cinder - sudo -u cinder cinder-manage db sync -fi - # Create the volumes directory for cinder if [ ! -d /var/lib/cinder/volumes ]; then mkdir -p /var/lib/cinder/volumes chown -R cinder:cinder /var/lib/cinder/volumes fi +# Setup the cinder database +if ! sudo -u postgres psql -lqt | grep -q cinder; then + # Create posgreSQL user + sudo -u postgres createuser \ + --pwprompt --encrypted \ + --no-adduser --no-createdb \ + --no-password \ + ##CINDER_DB_USER## + + sudo -u postgres createdb \ + --owner=##CINDER_DB_USER## \ + cinder + + sudo -u cinder cinder-manage db sync +fi + +chown -R cinder:cinder /var/lib/cinder + # This is only for testing purposes and we need to change it for # something more robust to deploy in production. # This also assumes that the user will add a second disk to its VM diff --git a/openstack/usr/share/openstack/openstack-glance-setup b/openstack/usr/share/openstack/openstack-glance-setup index 8a40de02..d9ee919e 100644 --- a/openstack/usr/share/openstack/openstack-glance-setup +++ b/openstack/usr/share/openstack/openstack-glance-setup @@ -36,13 +36,42 @@ keystone endpoint-create --service-id $(keystone service-list | awk '/ image / --internalurl ##GLANCE_INTERNAL_URL## \ --adminurl ##GLANCE_ADMIN_URL## -# Setup the glance database -if [ ! -e /var/lib/glance/glance.sqlite ]; then - chown -R glance:glance /var/lib/glance +# Create run directory for glance +if [ ! -d /var/run/glance ]; then + mkdir -p /var/run/glance + chown -R glance:glance /var/run/glance +fi + +# Create the lock directory for glance +if [ ! -d /var/lock/glance ]; then + mkdir -p /var/lock/glance + chown -R glance:glance /var/lock/glance +fi + +# Create the log directory for glance +if [ ! -d /var/log/glance ]; then + mkdir -p /var/log/glance chown -R glance:glance /var/log/glance +fi + +# Setup the glance database +if ! sudo -u postgres psql -lqt | grep -q glance; then + # Create posgreSQL user + sudo -u postgres createuser \ + --pwprompt --encrypted \ + --no-adduser --no-createdb \ + --no-password \ + ##GLANCE_DB_USER## + + sudo -u postgres createdb \ + --owner=##GLANCE_DB_USER## \ + glance + sudo -u glance glance-manage db_sync fi +chown -R glance:glance /var/lib/glance + # Remove the one-shot setup service rm /etc/systemd/system/multi-user.target.wants/openstack-glance-setup.service diff --git a/openstack/usr/share/openstack/openstack-keystone-setup b/openstack/usr/share/openstack/openstack-keystone-setup index 2e9a0dcb..9623f129 100644 --- a/openstack/usr/share/openstack/openstack-keystone-setup +++ b/openstack/usr/share/openstack/openstack-keystone-setup @@ -24,13 +24,40 @@ getent passwd keystone >/dev/null || \ useradd --uid 163 -r -g keystone -d /var/lib/keystone -s /sbin/nologin \ -c "OpenStack Keystone Daemons" keystone +# Keystone compute configuration +if [ ! -d /var/run/keystone ]; then + mkdir -p /var/run/keystone + chown -R keystone:keystone /var/run/keystone +fi + +if [ ! -d /var/lock/keystone ]; then + mkdir -p /var/lock/keystone + chown -R keystone:keystone /var/lock/keystone +fi + +if [ ! -d /var/log/keystone ]; then + mkdir -p /var/log/keystone + chown -R keystone:keystone /var/log/keystone +fi + # Setup the keystone database +if ! sudo -u postgres psql -lqt | grep -q keystone; then + # Create posgreSQL user + sudo -u postgres createuser \ + --pwprompt --encrypted \ + --no-adduser --no-createdb \ + --no-password \ + ##KEYSTONE_DB_USER## + + sudo -u postgres createdb \ + --owner=##KEYSTONE_DB_USER## \ + keystone -if [ ! -e /var/lib/keystone/keystone.sqlite ]; then - chown -R keystone:keystone /var/lib/keystone sudo -u keystone keystone-manage db_sync fi +chown -R keystone:keystone /var/lib/keystone + systemctl start openstack-keystone export OS_SERVICE_TOKEN=##KEYSTONE_TEMPORARY_ADMIN_TOKEN## diff --git a/openstack/usr/share/openstack/openstack-nova-setup b/openstack/usr/share/openstack/openstack-nova-setup index 345d5585..796fbdf5 100644 --- a/openstack/usr/share/openstack/openstack-nova-setup +++ b/openstack/usr/share/openstack/openstack-nova-setup @@ -61,8 +61,18 @@ if [ ! -d /var/lib/nova/instances ]; then fi # Setup the nova database -if [ ! -e /var/lib/nova/nova.sqlite ]; then - chown -R nova:nova /var/lib/nova +if ! sudo -u postgres psql -lqt | grep -q nova; then + # Create posgreSQL user + sudo -u postgres createuser \ + --pwprompt --encrypted \ + --no-adduser --no-createdb \ + --no-password \ + ##NOVA_DB_USER## + + sudo -u postgres createdb \ + --owner=##NOVA_DB_USER## \ + nova + sudo -u nova nova-manage db sync fi @@ -72,6 +82,8 @@ if [ ! -d /usr/share/novnc ]; then chown -R nova:nova /usr/share/novnc fi +chown -R nova:nova /var/lib/nova + # Add nova to the libvirt group usermod -a -G libvirt nova |