diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
commit | a453ac31f3428614cceb99027f8efbdb9258a40b (patch) | |
tree | f61f87408f32a8511cbd91799f9cececb53e0374 /collections-debian-merged/ansible_collections/google/cloud/roles/gcloud | |
parent | Initial commit. (diff) | |
download | ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.tar.xz ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.zip |
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collections-debian-merged/ansible_collections/google/cloud/roles/gcloud')
12 files changed, 325 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/LICENSE b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/LICENSE new file mode 100644 index 00000000..616fc1eb --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Eric Anderson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/README.md b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/README.md new file mode 100644 index 00000000..dfc365a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/README.md @@ -0,0 +1,60 @@ +# ericsysmin.gcloud + +[![Build Status](https://travis-ci.org/ericsysmin/ansible-role-gcloud.svg?branch=master)](https://travis-ci.org/ericsysmin/ansible-role-gcloud) + +This role installs the gcloud command-line tool on a linux system. + +## Requirements + +### Debian + +None + +### Ubuntu + +None + +### CentOS + +- epel (if using archive installation) + +## Role Variables + +All variables which can be overridden are stored in defaults/main.yml file as well as in table below. + +| Variable | Required | Default | Comments | +| ------------------------------ | -------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------- | +| `gcloud_install_type` | No | `package` | Type of install `package` or `archive` | +| `gcloud_apt_url` | No | `http://packages.cloud.google.com/apt` | URL of the APT Repository | +| `gcloud_apt_key` | No | `https://packages.cloud.google.com/apt/doc/apt-key.gpg` | GPG Key for the APT Repository | +| `gcloud_apt_repo` | No | `cloud-sdk-{{ ansible_distribution_release }}` | Name of the APT Repository | +| `gcloud_yum_baseurl` | No | `https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64` | URL of the YUM Repository | +| `gcloud_yum_key` | No | `https://packages.cloud.google.com/yum/doc/yum-key.gpg` | GPG Key for the YUM Repository | +| `gcloud_version` | No | `268.0.0` | Version of google-cloud-sdk to install | +| `gcloud_archive_name` | No | `google-cloud-sdk-{{ gcloud_version }}-linux-{{ ansible_architecture }}.tar.gz` | Full length name of gcloud archive | +| `gcloud_archive_url` | No | `https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/{{ gcloud_archive_name }}` | URL to download the gcloud archive | +| `gcloud_archive_path` | No | `/usr/lib` | Where should we unpack the archive | +| `gcloud_library_path` | No | `{{ gcloud_archive_path }}/google-cloud-sdk` | Path of the library after archive unpack | +| `gcloud_install_script` | No | `false` | Boolean: Execute install.sh from archive | +| `gcloud_usage_reporting` | No | `false` | Boolean: Disable anonymous usage reporting. | +| `gcloud_profile_path` | No | `false` | Profile to update with PATH and completion. | +| `gcloud_command_completion` | No | `false` | Boolean: Add a line for command completion in the profile | +| `gcloud_update_path` | No | `false` | Boolean: Add a line for path updating in the profile | +| `gcloud_override_components` | No | `[]` | Override the components that would be installed by default | +| `gcloud_additional_components` | No | `[]` | Additional components to installed | + +## Example Playbook + +```yaml +- hosts: servers + roles: + - role: ericsysmin.gcloud +``` + +## License + +MIT + +## Author Information + +[ericsysmin](https://ericsysmin.com) diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/defaults/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/defaults/main.yml new file mode 100644 index 00000000..b5c45344 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/defaults/main.yml @@ -0,0 +1,28 @@ +--- +# defaults file for gcloud +gcloud_install_type: package + +# default values for gcloud apt installation +gcloud_apt_key: https://packages.cloud.google.com/apt/doc/apt-key.gpg +gcloud_apt_url: http://packages.cloud.google.com/apt +gcloud_apt_repo: cloud-sdk-{{ ansible_distribution_release }} + +# default values for gcloud yum installation +gcloud_yum_baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 +gcloud_yum_key: https://packages.cloud.google.com/yum/doc/yum-key.gpg + +# default values for gcloud archive installation +gcloud_version: 268.0.0 +gcloud_archive_name: google-cloud-sdk-{{ gcloud_version }}-linux-{{ ansible_architecture }}.tar.gz +gcloud_archive_url: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/{{ gcloud_archive_name }} +gcloud_archive_path: /usr/lib +gcloud_library_path: "{{ gcloud_archive_path }}/google-cloud-sdk" + +# values if you want to use the gcloud install script +gcloud_install_script: false +gcloud_usage_reporting: false +gcloud_profile_path: false +gcloud_command_completion: false +gcloud_update_path: false +gcloud_override_components: [] +gcloud_additional_components: [] diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/meta/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/meta/main.yml new file mode 100644 index 00000000..50918c4a --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/meta/main.yml @@ -0,0 +1,21 @@ +--- +galaxy_info: + role_name: gcloud + author: Eric Anderson + description: Ansible role to install google-cloud-sdk + company: Avi Networks + license: MIT + min_ansible_version: 2.4 + platforms: + - name: Ubuntu + versions: + - precise + - trusty + - xenial + - bionic + galaxy_tags: + - gcloud + - google + - cloud + - sdk +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/archive_install.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/archive_install.yml new file mode 100644 index 00000000..b1a6606e --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/archive_install.yml @@ -0,0 +1,50 @@ +--- +- name: gcloud | Archive | Ensure temp path exists + file: path={{ gcloud_archive_path }} state=directory + +- name: gcloud | Archive | Extract Cloud SDK archive + unarchive: + src: "{{ gcloud_archive_url }}" + dest: "{{ gcloud_archive_path }}" + remote_src: yes + creates: "{{ gcloud_library_path }}" + +- name: gcloud | Archive | Link binaries to /usr/bin (like package install) + file: + src: "{{ gcloud_library_path }}/bin/{{ item }}" + dest: "/usr/bin/{{ item }}" + state: link + loop: + - bq + - docker-credential-gcloud + - gcloud + - git-credential-gcloud.sh + - gsutil + when: not gcloud_install_script + +- name: gcloud | Archive | Add command completion + include_tasks: command_completion.yml + when: gcloud_command_completion + +- name: gcloud | Archive | Install into Path + command: >- + {{ gcloud_archive_path }}/install.sh --quiet + --usage-reporting {{ gcloud_usage_reporting | lower }} + {% if gcloud_profile_path %} + --rc-path {{ gcloud_profile_path }} + {% endif %} + --command-completion {{ gcloud_command_completion | lower }} + --path-update {{ gcloud_update_path | lower }} + {% if gcloud_override_components | length > 0 %}--override-components + {% for component in gcloud_override_components %}{{ component }} + {% if loop.index < gcloud_override_components | length %} + {% endif %} + {% endfor %} + {% endif %} + {% if gcloud_additional_components | length > 0 %}--additional-components + {% for component in gcloud_additional_components %}{{ component }} + {% if loop.index < gcloud_additional_components | length %} + {% endif %} + {% endfor %} + {% endif %} + when: gcloud_install_script diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/command_completion.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/command_completion.yml new file mode 100644 index 00000000..866dbfb1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/command_completion.yml @@ -0,0 +1,32 @@ +--- +# task file to configure bash completion for gcloud +- name: gcloud | Archive | Debian | Ensure bash completion is installed + apt: name=bash-completion + register: task_result + until: task_result is success + retries: 10 + delay: 2 + when: ansible_os_family == "Debian" + +- name: gcloud | Archive | RedHat | Ensure bash completion is installed + yum: + name: + - bash-completion + register: task_result + until: task_result is success + retries: 10 + delay: 2 + when: ansible_os_family == "RedHat" + +- name: gcloud | Archive | Ensure bash_completion.d directory exists + file: + path: /etc/bash_completion.d + owner: root + group: root + state: directory + +- name: gcloud | Archive | Link binaries to /usr/bin (like package install) + file: + src: "{{ gcloud_library_path }}/completion.bash.inc" + dest: /etc/bash_completion.d/gcloud + state: link diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/main.yml new file mode 100644 index 00000000..7fff4934 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/main.yml @@ -0,0 +1,37 @@ +--- +# tasks to install gcloud via archive +- name: gcloud | Archive | Look for existing Google Cloud SDK installation + stat: + path: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" + register: gcloud_status + +- debug: var=gcloud_status + +- name: gcloud | Archive | Set installed version if installation exists + block: + - name: gcloud | Archive | Importing contents of {{ gcloud_archive_path }}/google-cloud-sdk/VERSION + slurp: + src: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" + register: gcloud_installed_version_data + - name: gcloud | Archive | Setting the gcloud_installed_version variable/fact + set_fact: + gcloud_installed_version: "{{ (gcloud_installed_version_data.content|b64decode|trim) }}" + - debug: + msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed" + - debug: + msg: >- + Skipping installation of google-cloud-sdk version {{ gcloud_version }} when + {{ gcloud_installed_version }} is already installed. + when: gcloud_version == gcloud_installed_version + when: gcloud_status.stat.exists + +- name: gcloud | Archive | Start installation + include_tasks: archive_install.yml + when: gcloud_installed_version is undefined or + gcloud_version is version(gcloud_installed_version, '>') + +- name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 + command: gcloud components install {{ item }} + register: gcloud_install_comp_status + changed_when: "'All components are up to date.' not in gcloud_install_comp_status.stderr_lines" + loop: "{{ gcloud_additional_components }}" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/main.yml new file mode 100644 index 00000000..090852f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/main.yml @@ -0,0 +1,15 @@ +--- + +- name: gcloud | Load Distro and OS specific variables + include_vars: "{{ lookup('first_found', params) }}" + vars: + params: + files: + - "os/{{ ansible_distribution|lower }}.yml" + - "os/{{ ansible_os_family|lower }}.yml" + - main.yml + paths: + - 'vars' + +- name: gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }} + include_tasks: "{{ gcloud_install_type }}/main.yml" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/debian.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/debian.yml new file mode 100644 index 00000000..f38df34b --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/debian.yml @@ -0,0 +1,27 @@ +--- +# 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 }}" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/main.yml new file mode 100644 index 00000000..c9b64ee5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/main.yml @@ -0,0 +1,5 @@ +--- +# tasks file for gcloud + +- name: gcloud | Start package installation for specific distro + include_tasks: "{{ ansible_os_family|lower }}.yml" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/redhat.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/redhat.yml new file mode 100644 index 00000000..1a8a17c0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/redhat.yml @@ -0,0 +1,28 @@ +--- +- 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 }}" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/vars/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/vars/main.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/vars/main.yml @@ -0,0 +1 @@ +--- |