Commit 4c9996b3 authored by Yehoshua Talansky's avatar Yehoshua Talansky

initial draft

parents
#/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
echo "This script is only meant for provisioning Coreos do not use for other os"
#give runner 3 secs to cancel
sleep 3 # Waits 3 seconds.
#create location for docker-compose
mkdir -p /opt/bin
export DOCKER_COMPOSE_VERSION=`git ls-remote --tags git://github.com/docker/compose.git | awk '{print $2}' |grep -v "docs\|rc" |awk -F'/' '{print $3}' |sort -V |tail -n1`
curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
echo "now provisioning core user ..."
sudo -u core bash << EOF
#remove bashrc and replace with its own to make sure it has the path to docker-compose
rm ~/.bashrc
cp /usr/share/skel/.bashrc ~/.bashrc
echo -e "\n#add docker compose to path\nexport PATH=\$PATH" >> ~/.bashrc
source ~/.bashrc
ssh-keygen -f ~/.ssh/id_rsa -N '' -t rsa -b 4096 -C "gitlab-runner"
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa
echo "now add private key above for gitlab secret jobs so it can login to core user"
EOF
echo "Done"
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