| Branch | Pipeline |
|---|---|
| master |
This Ansible role to install Google Cloud SDK on Ubuntu and macOS development machines.
Do not use this on production servers.
The role installs Cloud SDK by default into ~/google-cloud-sdk.
To install to another location, change the gcloud_install_dir variable. It
will be used as the installation directory relative to the user home directory.
For example to install into ~/opt/google-cloud-sdk, you can set:
# Install to ~/opt/google-cloud-sdk
gcloud_install_dir: "/opt"For backwards compatibility, the role will automatically detect existing
installation in ~/opt/google-cloud-sdk and default to this location
if found.
The current Google Cloud SDK installer will look for available Python versions
and prefer python2 over python3.
You can enable python3 to be preferred over python2 during install.
gcloud_prefer_python3: trueTo install Cloud SDK from the package manager where available, enable it in Ansible configuration:
# Install Cloud SDK from APT
gcloud_install_from_package_manager: trueThis is only supported on Debian-based systems with APT repositories.
This role makes changes to the .bashrc and .zshrc files if these exist in
your home directory. It will resolve any symbolic links to your dotfiles
when making changes.
Code completion for gcloud command is loaded with all installation options.
If you're managing your shell scripts .dotfiles or are using a framework, you
should set gcloud_setup_shell to false and update these files yourself to
keep them clean.
# Do not mess with my dotfiles!
gcloud_setup_shell: falseReference .bashrc configuration when installed into
~/google-cloud-sdk using the archive:
if [ -d "$HOME/google-cloud-sdk" ]; then
export CLOUDSDK_ROOT_DIR="$HOME/google-cloud-sdk"
# Update PATH for the Google Cloud SDK.
source $CLOUDSDK_ROOT_DIR/path.bash.inc
# Enable bash completion for gcloud.
source $CLOUDSDK_ROOT_DIR/completion.bash.inc
fiIf your .bashrc already has a export CLOUDSDK_ROOT_DIR= line, the file
will not be modified.
Reference .bashrc configuration when installed from APT:
if [ -d "/usr/share/google-cloud-sdk" ]; then
# Enable zsh completion for gcloud.
source /usr/share/google-cloud-sdk/completion.bash.inc
fiReference .zshrc configuration when installed into
~/google-cloud-sdk using the archive:
if [ -d "$HOME/google-cloud-sdk" ]; then
export CLOUDSDK_ROOT_DIR="$HOME/google-cloud-sdk"
# Update PATH for the Google Cloud SDK.
source $CLOUDSDK_ROOT_DIR/path.zsh.inc
# Enable zsh completion for gcloud.
source $CLOUDSDK_ROOT_DIR/completion.zsh.inc
fiIf your .zshrc already has a export CLOUDSDK_ROOT_DIR= line, the file
will not be modified.
Reference .zshrc configuration when installed from APT:
if [ -d "/usr/share/google-cloud-sdk" ]; then
# Enable zsh completion for gcloud.
source /usr/share/google-cloud-sdk/completion.zsh.inc
fiUpdate Cloud SDK version in Ansible variables:
make updateInstall pre-commit hooks and validate coding style:
make lintRun tests in Ubuntu and Debian using Docker:
make testInstallation script is based on ansible/role-install-gcloud Ansible role by @chouseknecht.