fix role tests

Ansible role tests were failing due to ansible-lint reporting
multiple errors.

Fixing those errors resolves the failing tests.

Switching gcsfuse to use gcloud's bootstrap to follow the current
docker install instructions.

Removing centos as it's a discontinued distribution.

Adding a check to ensure integration tests are skipped unless they
are run by a branch (a public fork does not pass required
integration test credentials).
This commit is contained in:
Yusuke Tsutsumi 2022-11-26 07:00:46 +00:00 committed by Yusuke Tsutsumi
commit f692dd4c76
21 changed files with 113 additions and 96 deletions

View file

@ -1,16 +1,16 @@
---
- name: gcloud | Archive | Ensure temp path exists
file: path={{ gcloud_archive_path }} state=directory mode=0755
ansible.builtin.file: path={{ gcloud_archive_path }} state=directory mode=0755
- name: gcloud | Archive | Extract Cloud SDK archive
unarchive:
ansible.builtin.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:
ansible.builtin.file:
src: "{{ gcloud_library_path }}/bin/{{ item }}"
dest: "/usr/bin/{{ item }}"
state: link
@ -23,11 +23,11 @@
when: not gcloud_install_script
- name: gcloud | Archive | Add command completion
include_tasks: command_completion.yml
ansible.builtin.include_tasks: command_completion.yml
when: gcloud_command_completion
- name: gcloud | Archive | Install into Path
command: >-
ansible.builtin.command: >-
{{ gcloud_archive_path }}/install.sh --quiet
--usage-reporting {{ gcloud_usage_reporting | lower }}
{% if gcloud_profile_path %}

View file

@ -1,7 +1,7 @@
---
# task file to configure bash completion for gcloud
- name: gcloud | Archive | Debian | Ensure bash completion is installed
apt: name=bash-completion
ansible.builtin.apt: name=bash-completion
register: task_result
until: task_result is success
retries: 10
@ -9,7 +9,7 @@
when: ansible_os_family == "Debian"
- name: gcloud | Archive | RedHat | Ensure bash completion is installed
yum:
ansible.builtin.yum:
name:
- bash-completion
register: task_result
@ -19,7 +19,7 @@
when: ansible_os_family == "RedHat"
- name: gcloud | Archive | Ensure bash_completion.d directory exists
file:
ansible.builtin.file:
path: /etc/bash_completion.d
owner: root
group: root
@ -27,7 +27,7 @@
mode: 0755
- name: gcloud | Archive | Link binaries to /usr/bin (like package install)
file:
ansible.builtin.file:
src: "{{ gcloud_library_path }}/completion.bash.inc"
dest: /etc/bash_completion.d/gcloud
state: link

View file

@ -1,27 +1,27 @@
---
# tasks to install gcloud via archive
- name: gcloud | Archive | Look for existing Google Cloud SDK installation
stat:
ansible.builtin.stat:
path: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION"
register: gcloud_status
- name: gcloud | Archive | Get gcloud_status
debug: var=gcloud_status
ansible.builtin.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:
- name: gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }}
ansible.builtin.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:
ansible.builtin.set_fact:
gcloud_installed_version: "{{ (gcloud_installed_version_data.content|b64decode|trim) }}"
- name: gcloud | Archive | get the gcloud_installed_version
debug:
ansible.builtin.debug:
msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed"
- name: gcloud | Archive | Version already installed
debug:
ansible.builtin.debug:
msg: >-
Skipping installation of google-cloud-sdk version {{ gcloud_version }} when
{{ gcloud_installed_version }} is already installed.
@ -29,12 +29,12 @@
when: gcloud_status.stat.exists
- name: gcloud | Archive | Start installation
include_tasks: archive_install.yml
ansible.builtin.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 }}
ansible.builtin.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 }}"

View file

@ -1,7 +1,7 @@
---
- name: gcloud | Load Distro and OS specific variables
include_vars: "{{ lookup('first_found', params) }}"
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
@ -12,4 +12,4 @@
- 'vars'
- name: gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }}
include_tasks: "{{ gcloud_install_type }}/main.yml"
ansible.builtin.include_tasks: "{{ gcloud_install_type }}/main.yml"

View file

@ -1,25 +1,25 @@
---
# tasks that install gcloud on debian
- name: gcloud | Debian | Add an Apt signing key, uses whichever key is at the URL
apt_key:
ansible.builtin.apt_key:
url: "{{ gcloud_apt_key }}"
state: present
- name: gcloud | Debian | Add the gcloud repository
apt_repository:
ansible.builtin.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
ansible.builtin.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
ansible.builtin.apt: name=google-cloud-sdk-{{ item }} update_cache=yes
register: task_result
until: task_result is success
retries: 10

View file

@ -2,4 +2,4 @@
# tasks file for gcloud
- name: gcloud | Start package installation for specific distro
include_tasks: "{{ ansible_os_family|lower }}.yml"
ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml"

View file

@ -1,9 +1,9 @@
---
- name: gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL
yum_repository:
ansible.builtin.yum_repository:
name: google-cloud-sdk
description: Google Cloud SDK
file: google-cloud-sdk
ansible.builtin.file: google-cloud-sdk
baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled: yes
gpgcheck: yes
@ -13,14 +13,14 @@
- 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
ansible.builtin.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
ansible.builtin.yum: name=google-cloud-sdk-{{ item }} update_cache=yes
register: task_result
until: task_result is success
retries: 10

View file

@ -1,24 +1,24 @@
---
- name: gcsfuse | Ensure gpg is installed
apt: name=gnupg
ansible.builtin.apt: name=gnupg
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: gcsfuse | Add an apt signing key
apt_key:
ansible.builtin.apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
- name: gcsfuse | Add the apt repository
apt_repository:
ansible.builtin.apt_repository:
repo: deb http://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main
state: present
filename: gcsfuse
- name: gcsfuse | Install gcsfuse
apt: name=gcsfuse update_cache=yes
ansible.builtin.apt: name=gcsfuse update_cache=yes
register: task_result
until: task_result is success
retries: 10

View file

@ -1,4 +1,4 @@
---
# tasks file for google.cloud.gcsfuse
- include_tasks: "{{ ansible_os_family|lower }}.yml"
- name: main
ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml"