Skip to content

Instantly share code, notes, and snippets.

@rm-you
Last active June 11, 2021 18:47
Show Gist options
  • Save rm-you/6feacb91182f5c011018 to your computer and use it in GitHub Desktop.
Save rm-you/6feacb91182f5c011018 to your computer and use it in GitHub Desktop.
Barbican Devstack init script
#!/bin/bash
# Set up the packages we need
apt-get update
apt-get install git vim -y
# Clone the devstack repo
git clone https://github.com/openstack-dev/devstack.git /tmp/devstack
cat <<EOF > /tmp/devstack/localrc
enable_plugin barbican https://review.openstack.org/openstack/barbican
KEYSTONE_TOKEN_FORMAT=UUID
HOST_IP=127.0.0.1
DATABASE_PASSWORD=secretdatabase
RABBIT_PASSWORD=secretrabbit
ADMIN_PASSWORD=secretadmin
SERVICE_PASSWORD=secretservice
SERVICE_TOKEN=111222333444
# Enable Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
# Pre-requisite
ENABLED_SERVICES=rabbit,mysql,key
# Nova
#ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch
#IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
# Glance
#ENABLED_SERVICES+=,g-api,g-reg
# Neutron
#ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron
# Cinder
#ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch
# Tempest
ENABLED_SERVICES+=,tempest
EOF
# Create the stack user
/tmp/devstack/tools/create-stack-user.sh
# Move everything into place
mv /tmp/devstack /opt/stack/
chown -R stack:stack /opt/stack/devstack/
# Fix permissions on current tty so screens can attach
chmod go+rw `tty`
# Let's rock
su - stack -c /opt/stack/devstack/stack.sh
# Add environment variables for auth/endpoints
echo 'source /opt/stack/devstack/openrc admin admin' >> /opt/stack/.bashrc
echo 'export BARBICAN_ENDPOINT="http://localhost:9311"' >> /opt/stack/.bashrc
# Install tox globally
pip install tox
# Run Barbican functional tests
su - stack -c "cd /opt/stack/barbican/ && tox -e functional"
# Drop into a shell
su - stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment