---
# tasks that install gcloud on debian
- name: gcloud | Debian | Add an Apt signing key, uses whichever key is at the URL
  apt_key:
    url: "{{ gcloud_apt_key }}"
    state: present

- name: gcloud | Debian | Add the gcloud repository
  apt_repository:
    repo: "deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main"
    state: present
    filename: google-cloud-sdk

- name: gcloud | Debian | Install the google-cloud-sdk package
  apt: 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
  apt: name=google-cloud-sdk-{{ item }} update_cache=yes
  register: task_result
  until: task_result is success
  retries: 10
  delay: 2
  loop: "{{ gcloud_additional_components }}"
