Skip to content

labasubagia/ansible-role-gcloud

Repository files navigation

Google Cloud CLI

Ansible role to install Google Cloud CLI linux

Recommended to install inside home user directory (by official documentation) as non-root

Requirements

  • Ansible Core >= 2.16
  • Tested Linux Distribution
    • Debian 12
    • Ubuntu 24.04
    • Fedora 40

Note: Other distributions likely to work but not been tested

Role Variables

The following variables will change the behavior of this role (default values are shown below):

## google recommends to install gcloud sdk in user directory, not as root
gcloud_install_dir: "{{ ansible_env.HOME }}"
gcloud_additional_components: []
gcloud_state: present # present/absent

# For this file you need to make sure it is exists
# Otherwise it will be skipped
gcloud_fish_config: "{{ ansible_env.HOME }}/.config/fish/config.fish"
gcloud_bash_config: "{{ ansible_env.HOME }}/.bashrc"
gcloud_zsh_config: "{{ ansible_env.HOME }}/.zshrc"

Example Playbook

- hosts: servers
  roles:
    - role: labasubagia.gcloud
      vars:
        gcloud_additional_components:
          - gke-gcloud-auth-plugin
          - kubectl

License

MIT

Author Information

Laba Subagia