Update Vagrant + Packer in CI builds

This commit is contained in:
Chris Long
2021-07-11 09:45:08 -07:00
parent 3f976bb2f4
commit 4f1d381e20
3 changed files with 14 additions and 26 deletions

View File

@@ -79,8 +79,8 @@ ufw --force enable
echo "[$(date +%H:%M:%S)]: Installing Vagrant..." echo "[$(date +%H:%M:%S)]: Installing Vagrant..."
mkdir /opt/vagrant mkdir /opt/vagrant
cd /opt/vagrant || exit 1 cd /opt/vagrant || exit 1
wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_x86_64.deb wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.17/vagrant_2.2.17_x86_64.deb
dpkg -i vagrant_2.2.16_x86_64.deb dpkg -i vagrant_2.2.17_x86_64.deb
echo "[$(date +%H:%M:%S)]: Installing vagrant-reload plugin..." echo "[$(date +%H:%M:%S)]: Installing vagrant-reload plugin..."
vagrant plugin install vagrant-reload vagrant plugin install vagrant-reload

View File

@@ -25,8 +25,8 @@ git clone https://github.com/clong/DetectionLab.git /opt/DetectionLab
# Install Vagrant # Install Vagrant
mkdir /opt/vagrant mkdir /opt/vagrant
cd /opt/vagrant || exit 1 cd /opt/vagrant || exit 1
wget https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_x86_64.deb wget https://releases.hashicorp.com/vagrant/2.2.17/vagrant_2.2.17_x86_64.deb
dpkg -i vagrant_2.2.16_x86_64.deb dpkg -i vagrant_2.2.17_x86_64.deb
# Disable IPv6 - may help with the vagrant-reload plugin: https://github.com/hashicorp/vagrant/issues/8795#issuecomment-468945063 # Disable IPv6 - may help with the vagrant-reload plugin: https://github.com/hashicorp/vagrant/issues/8795#issuecomment-468945063
echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf
@@ -43,8 +43,8 @@ cd /opt/DetectionLab/Vagrant || exit 1
# Install Packer # Install Packer
mkdir /opt/packer mkdir /opt/packer
cd /opt/packer || exit 1 cd /opt/packer || exit 1
wget --progress=bar:force https://releases.hashicorp.com/packer/1.6.6/packer_1.6.6_linux_amd64.zip wget --progress=bar:force https://releases.hashicorp.com/packer/1.7.3/packer_1.7.3_linux_amd64.zip
unzip packer_1.6.6_linux_amd64.zip unzip packer_1.7.3_linux_amd64.zip
cp packer /usr/local/bin/packer cp packer /usr/local/bin/packer
# Make the Packer images headless # Make the Packer images headless

View File

@@ -4,7 +4,6 @@
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
export SERIALNUMBER="SECRET" export SERIALNUMBER="SECRET"
export LICENSEFILE="SECRET"
sed -i 's#http://archive.ubuntu.com#http://us.archive.ubuntu.com#g' /etc/apt/sources.list sed -i 's#http://archive.ubuntu.com#http://us.archive.ubuntu.com#g' /etc/apt/sources.list
@@ -14,9 +13,9 @@ apt-get install -y linux-headers-"$(uname -r)" build-essential unzip git ufw apa
pip install awscli --upgrade --user pip install awscli --upgrade --user
cp /root/.local/bin/aws /usr/local/bin/aws && chmod +x /usr/local/bin/aws cp /root/.local/bin/aws /usr/local/bin/aws && chmod +x /usr/local/bin/aws
wget -O VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle "https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle" wget -O VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle "https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle"
chmod +x VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle chmod +x VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle
sudo sh VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle --console --required --eulas-agreed --set-setting vmware-workstation serialNumber $SERIALNUMBER sudo sh VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle --console --required --eulas-agreed --set-setting vmware-workstation serialNumber $SERIALNUMBER
# Set up firewall # Set up firewall
ufw allow ssh ufw allow ssh
@@ -28,15 +27,13 @@ git clone https://github.com/clong/DetectionLab.git /opt/DetectionLab
# Install Vagrant # Install Vagrant
mkdir /opt/vagrant mkdir /opt/vagrant
cd /opt/vagrant || exit 1 cd /opt/vagrant || exit 1
wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_x86_64.deb wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.17/vagrant_2.2.17_x86_64.deb
dpkg -i vagrant_2.2.16_x86_64.deb dpkg -i vagrant_2.2.17_x86_64.deb
# Disable IPv6 - may help with the vagrant-reload plugin: https://github.com/hashicorp/vagrant/issues/8795#issuecomment-468945063 # Disable IPv6 - may help with the vagrant-reload plugin: https://github.com/hashicorp/vagrant/issues/8795#issuecomment-468945063
echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf > /dev/null sysctl -p /etc/sysctl.conf > /dev/null
vagrant plugin install vagrant-reload vagrant plugin install vagrant-reload
vagrant plugin install vagrant-vmware-desktop vagrant plugin install vagrant-vmware-desktop
echo $LICENSEFILE | base64 -d > /tmp/license.lic
vagrant plugin license vagrant-vmware-desktop /tmp/license.lic
wget --progress=bar:force "https://releases.hashicorp.com/vagrant-vmware-utility/1.0.20/vagrant-vmware-utility_1.0.20_x86_64.deb" wget --progress=bar:force "https://releases.hashicorp.com/vagrant-vmware-utility/1.0.20/vagrant-vmware-utility_1.0.20_x86_64.deb"
dpkg -i vagrant-vmware-utility_1.0.20_x86_64.deb dpkg -i vagrant-vmware-utility_1.0.20_x86_64.deb
@@ -50,21 +47,12 @@ cd /opt/DetectionLab/Vagrant || exit 1
# Install Packer # Install Packer
mkdir /opt/packer mkdir /opt/packer
cd /opt/packer || exit 1 cd /opt/packer || exit 1
wget --progress=bar:force https://releases.hashicorp.com/packer/1.6.6/packer_1.6.6_linux_amd64.zip wget --progress=bar:force https://releases.hashicorp.com/packer/1.7.3/packer_1.7.3_linux_amd64.zip
unzip packer_1.6.6_linux_amd64.zip unzip packer_1.7.3_linux_amd64.zip
cp packer /usr/local/bin/packer cp packer /usr/local/bin/packer
# Make the Packer images headless # Make the Packer images headless
cd /opt/DetectionLab/Packer || exit 1 cd /opt/DetectionLab/Packer || exit 1
for file in *.json; do for file in *.json; do
sed -i 's/"headless": false,/"headless": true,/g' "$file"; sed -i 's/"headless": false,/"headless": true,/g' "$file";
done done
echo '# This file is automatically generated.
# Hand-editing this file is not recommended.
network0.name = "Bridged"
network0.device = "vmnet0"
network1.name = "HostOnly"
network1.device = "vmnet1"
network2.name = "NAT"
network2.device = "vmnet8"' > /etc/vmware/netmap.conf