Skip to content

Instantly share code, notes, and snippets.

@kmassada
Created October 31, 2017 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmassada/38c3bd5b096c4c0a6963c0a7b572b262 to your computer and use it in GitHub Desktop.
Save kmassada/38c3bd5b096c4c0a6963c0a7b572b262 to your computer and use it in GitHub Desktop.
Re-install GCP services for your nodes
#!/bin/bash
declare -a PKG_LIST=(google-cloud-packages-archive-keyring \
google-compute-engine google-compute-engine-oslogin \
python-google-compute-engine python3-google-compute-engine)
declare -x APT_SERVER="packages.cloud.google.com"
curl https://$APT_SERVER/apt/doc/apt-key.gpg | apt-key add -
DEB_DIST=$(cat /etc/os-release | grep "VERSION=" \
| sed "s/\"\|(\|)\|VERSION=//g" | awk '{print tolower($NF)}')
tee /etc/apt/sources.list.d/google-cloud.list << EOM
deb http://$APT_SERVER/apt google-compute-engine-${DEB_DIST}-stable main
deb http://$APT_SERVER/apt google-cloud-packages-archive-keyring-${DEB_DIST} main
EOM
apt-get update
for pkg in ${PKG_LIST[@]}; do
echo "Running apt install $pkg..."
apt install -y $pkg
done
reboot now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment