-
Notifications
You must be signed in to change notification settings - Fork 1
/
jenkins-install.sh
45 lines (31 loc) · 1.61 KB
/
jenkins-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
apt-get remove -y docker docker-engine docker.io containerd runc
apt-get update
apt-get install -y software-properties-common gnupg2 curl
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --yes --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
. /etc/lsb-release
echo "here is the Ubuntu version"
echo $DISTRIB_CODENAME
if [ $DISTRIB_CODENAME = "xenial" ]
then
echo "Ubuntu version: Xenial"
#snap install terraform
#snap install packer
#alias terraform="/snap/terraform/current/terraform"
#alias packer="/snap/packer/current/bin/packer"
echo "Ansible that is available with Xenial is not supported by this project"
exit 1
fi
wget -qO - terraform.gpg https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/terraform-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/terraform-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/terraform.list
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io p7zip-full default-jre nano awscli ansible terraform packer
docker run hello-world
docker run -p 8080:8080 -d --name jenkins jenkins/jenkins:lts
echo "Wait for Jenkins container to start"
sleep 30
echo "Here is your Jenkins initial install password: "
docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword