Commit 0165e933 authored by sb akton's avatar sb akton

Updated srvmgmt docker + startup script

parent 4ed5b139
# Ubuntu 18.04
FROM ubuntu:bionic
RUN apt-get update
#RUN apt-get upgrade -y
# Install zip utility
RUN apt-get install -y p7zip-full nano sudo
RUN apt-get update
#install python 3.6 + pip + pillow
RUN apt-get update
RUN apt-get install -y python3 python3-pip python3-pillow
# install openstack for python3
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-openstacksdk python3-openstackclient
# ---------------
# SOBLOO user
# ---------------
RUN useradd -m -k /etc/skel -s /bin/bash sobloo \
&& echo "sobloo:sobloo" | chpasswd \
&& echo "sobloo ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
# copy and run bootstrap
WORKDIR /home/sobloo/scripts
COPY start_stopSRV.sh ./
#----------------------
# Fix some permissions
#----------------------
RUN chown -R sobloo:sobloo /home/sobloo \
&& chmod -R ug+rw,o-rwx /home/sobloo \
&& find /home/sobloo -type d -exec chmod ug+x {} \;
RUN chown -R sobloo:sobloo /home/sobloo/scripts
# run cmdline
ENTRYPOINT ["/home/sobloo/scripts/start_stopSRV.sh"]
CMD []
#!/bin/bash
#echo "Received params 1:$1 2:$2 3:$3 4:$4 5:$5"
if [ $# -ne 5 ] ; then
echo "Usage [program] {START/STOP/STAT} {DOMAIN} {USER} {PASSWORD} {SERVER}"
else
export OS_AUTH_URL="https://iam.eu-west-0.prod-cloud-ocb.orange-business.com/v3"
export OS_PROJECT_NAME=eu-west-0
export OS_USERNAME=$3
export OS_IDENTITY_API_VERSION="3"
export OS_IMAGE_API_VERSION="2"
export OS_NETWORK_API_VERSION="2"
export OS_REGION_NAME="eu-west-0"
export OS_USER_DOMAIN_NAME=$2
export OS_PASSWORD=$4
if [ "$1" == "START" ] ; then
openstack server start ${5}
fi
if [ "$1" == "STOP" ] ; then
openstack server stop ${5}
fi
if [ "$1" == "STAT" ] ; then
openstack server list
fi
fi
......@@ -7,6 +7,5 @@ else
user=$3
passwd=$4
srv=$5
docker run -rm registry.gitlab.com/pub-sobloo/support/srvmgmt $cmd $tenant $user $passwd $srv
docker run --rm registry.gitlab.com/pub-sobloo/support/svrmgmt:latest $cmd $tenant $user $passwd $srv
fi
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