Add vagrant-specific prep and install scripts

This commit is contained in:
Matt Nikkel
2020-08-29 23:37:06 -04:00
parent 6c3203e117
commit af7884f887
3 changed files with 67 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
artifacts
local-artifacts
airgap-scp.sh
.vagrant

33
k3ama-vagrant-install.sh Executable file
View File

@@ -0,0 +1,33 @@
if [ -f "/usr/local/bin/k3s-uninstall.sh" ]; then
/usr/local/bin/k3s-uninstall.sh
else
echo "k3s is not installed"
fi
if pgrep -x "firewalld" >/dev/null
then
echo "[FATAL] disable firewalld first"
fi
SELINUXSTATUS=$(getenforce)
if [ "$SELINUXSTATUS" == "Permissive" ]; then
echo "[FATAL] disable selinux"
exit 1
else
echo "SELINUX disabled. continuing"
fi
LOCAL_IMAGES_FILEPATH=/var/lib/rancher/k3s/agent/images
mkdir -p ${LOCAL_IMAGES_FILEPATH}
cp /opt/k3ama/local-artifacts/images/k3s-airgap-images-amd64.tar ${LOCAL_IMAGES_FILEPATH}
cp /opt/k3ama/local-artifacts/bin/k3s /usr/local/bin/k3s
chmod +x /usr/local/bin/k3s
yum install -y /opt/k3ama/local-artifacts/rpm/*
INSTALL_K3S_SKIP_DOWNLOAD=true /opt/k3ama/local-artifacts/bin/k3s-install.sh
chmod +r /etc/rancher/k3s/k3s.yaml

33
k3ama-vagrant-prep.sh Executable file
View File

@@ -0,0 +1,33 @@
K3S_VERSION='v1.18.8%2Bk3s1'
ADDL_IMAGES=./local-artifacts/images
LOCAL_BIN=./local-artifacts/bin
LOCAL_RPM=./local-artifacts/rpm
mkdir -p ${ADDL_IMAGES}
mkdir -p ${LOCAL_BIN}
pushd ${ADDL_IMAGES}
curl -LO https://github.com/rancher/k3s/releases/download/${K3S_VERSION}/k3s-airgap-images-amd64.tar
popd
pushd ${LOCAL_BIN}
curl -LO https://github.com/rancher/k3s/releases/download/${K3S_VERSION}/k3s
chmod +x k3s
curl -L https://raw.githubusercontent.com/rancher/k3s/${K3S_VERSION}/install.sh -o k3s-install.sh
chmod +x k3s-install.sh
popd
pushd ${LOCAL_RPM}
curl -LO https://rpm.rancher.io/k3s-selinux-0.1.1-rc1.el7.noarch.rpm
# on machine with yum installed and internet access:
# yum install -y yum-utils
# yumdownloader --destdir=. --resolve container-selinux selinux-policy-base
popd