-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
47 lines (42 loc) · 1.47 KB
/
Vagrantfile
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
43
44
45
46
47
# frozen_string_literal: true
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.box = 'arfreitas/centos7-vbguest'
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
config.vm.network 'forwarded_port', guest: 8080, host: 8080, id: 'jenkins'
config.vm.provider 'virtualbox' do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
vb.memory = '2048'
vb.cpus = '2'
vb.name = 'jenkins-sample'
end
config.vm.provision 'shell', inline: <<~SHELL
set -e
yum makecache fast
yum upgrade -y
yum group install 'Development Tools' -y
yum install -y git python3-pip python3-jenkins java-11-openjdk bzip2-devel libsqlite3x-devel glibc-common tk-devel python36-xmltodict libffi-devel
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum makecache fast
yum install jenkins -y
systemctl enable jenkins
systemctl start jenkins
pwd_file=/var/lib/jenkins/secrets/initialAdminPassword
while test 1
do
if ![ -f "${pwd_file}" ]
then
sleep 5
else
echo 'Initial admin password for Jenkins:'
cat "${pwd_file}"
break
fi
done
SHELL
end