---
- name: gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL
  yum_repository:
    name: google-cloud-sdk
    description: Google Cloud SDK
    file: google-cloud-sdk
    baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
    enabled: yes
    gpgcheck: yes
    repo_gpgcheck: yes
    gpgkey:
      - https://packages.cloud.google.com/yum/doc/yum-key.gpg
      - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

- name: gcloud | RHEL | Install the google-cloud-sdk package
  yum: name=google-cloud-sdk update_cache=yes
  register: task_result
  until: task_result is success
  retries: 10
  delay: 2

- name: gcloud | Debian | Install the google-cloud-sdk additional components
  yum: name=google-cloud-sdk-{{ item }} update_cache=yes
  register: task_result
  until: task_result is success
  retries: 10
  delay: 2
  loop: "{{ gcloud_additional_components }}"
