mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 07:01:56 +03:00
44 lines
1.1 KiB
Bash
44 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
# volume setup
|
|
vgchange -ay
|
|
|
|
DEVICE_FS=`blkid -o value -s TYPE ${DEVICE}`
|
|
if [ "`echo -n $DEVICE_FS`" == "" ] ; then
|
|
pvcreate ${DEVICE}
|
|
vgcreate data ${DEVICE}
|
|
lvcreate --name volume1 -l 100%FREE data
|
|
mkfs.ext4 /dev/data/volume1
|
|
fi
|
|
mkdir -p /var/lib/jenkins
|
|
echo '/dev/data/volume1 /var/lib/jenkins ext4 defaults 0 0' >> /etc/fstab
|
|
mount /var/lib/jenkins
|
|
|
|
# install jenkins and docker
|
|
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
|
|
echo "deb http://pkg.jenkins.io/debian-stable binary/" >> /etc/apt/sources.list
|
|
apt-get update
|
|
apt-get install -y jenkins=${JENKINS_VERSION} unzip docker.io
|
|
|
|
# enable docker and add perms
|
|
usermod -G docker jenkins
|
|
systemctl enable docker
|
|
service docker start
|
|
service jenkins restart
|
|
|
|
# install pip
|
|
wget -q https://bootstrap.pypa.io/get-pip.py
|
|
python get-pip.py
|
|
python3 get-pip.py
|
|
rm -f get-pip.py
|
|
# install awscli
|
|
pip install awscli
|
|
|
|
# install terraform
|
|
cd /usr/local/bin
|
|
wget -q https://releases.hashicorp.com/terraform/0.7.7/terraform_0.7.7_linux_amd64.zip
|
|
unzip terraform_0.7.7_linux_amd64.zip
|
|
# clean up
|
|
apt-get clean
|
|
rm terraform_0.7.7_linux_amd64.zip
|