fixing ansible-lint errors, fix gcsfuse

Ansible-lint is required for Ansible collection
certification for Automation Hub.

gcsfuse had no metadata associated with it, failing
the Ansible Hub upload.
This commit is contained in:
Yusuke Tsutsumi 2022-12-10 09:54:28 -08:00 committed by Yusuke Tsutsumi
parent a9545c77a4
commit 4907356bba
16 changed files with 71 additions and 33 deletions

View file

@ -3,7 +3,7 @@ on: [pull_request]
env: env:
PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14
jobs: jobs:
sanity: sanity-and-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
@ -22,14 +22,14 @@ jobs:
with: with:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
- name: Install ansible-base (${{ matrix.ansible_version }}) - name: Install ansible-base (${{ matrix.ansible_version }})
uses: nick-invision/retry@v2 run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
with: - name: Run ansible-test sanity
timeout_minutes: 3
max_attempts: 3
command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
- name: Run sanity tests
# validate-modules cannot be turned on until #498 is resolved. # validate-modules cannot be turned on until #498 is resolved.
run: ansible-test sanity -v --color --python "$PYTHON_VERSION" --skip validate-modules run: ansible-test sanity -v --color --python "$PYTHON_VERSION" --skip validate-modules
- name: Install ansible-lint
run: pip install ansible-lint
- name: Run ansible-lint
run: ansible-lint
unit: unit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:

View file

@ -3,19 +3,20 @@
hosts: all hosts: all
pre_tasks: pre_tasks:
- name: Update package cache - name: Update package cache
ansible.builtin.package: update_cache=yes ansible.builtin.package:
update_cache: "yes"
changed_when: false changed_when: false
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10
delay: 2 delay: 2
- name: create containerd folder - name: Create containerd folder
ansible.builtin.file: ansible.builtin.file:
path: /etc/systemd/system/containerd.service.d path: /etc/systemd/system/containerd.service.d
state: directory state: directory
mode: 0755 mode: 0755
when: ansible_service_mgr == "systemd" when: ansible_service_mgr == "systemd"
- name: override file for containerd - name: Override file for containerd
ansible.builtin.copy: ansible.builtin.copy:
src: files/override.conf src: files/override.conf
dest: /etc/systemd/system/containerd.service.d/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf

View file

@ -3,7 +3,8 @@
hosts: all hosts: all
pre_tasks: pre_tasks:
- name: Update package cache - name: Update package cache
ansible.builtin.package: update_cache=yes ansible.builtin.package:
update_cache: "yes"
changed_when: false changed_when: false
register: task_result register: task_result
until: task_result is success until: task_result is success

View file

@ -4,7 +4,7 @@ galaxy_info:
author: Eric Anderson author: Eric Anderson
description: Ansible role to install google-cloud-sdk description: Ansible role to install google-cloud-sdk
license: GPL-3.0 license: GPL-3.0
min_ansible_version: 2.9 min_ansible_version: "2.9"
platforms: platforms:
- name: Ubuntu - name: Ubuntu
versions: versions:

View file

@ -1,6 +1,9 @@
--- ---
- name: gcloud | Archive | Ensure temp path exists - name: gcloud | Archive | Ensure temp path exists
ansible.builtin.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 - name: gcloud | Archive | Extract Cloud SDK archive
ansible.builtin.unarchive: ansible.builtin.unarchive:

View file

@ -1,7 +1,8 @@
--- ---
# task file to configure bash completion for gcloud # task file to configure bash completion for gcloud
- name: gcloud | Archive | Debian | Ensure bash completion is installed - name: gcloud | Archive | Debian | Ensure bash completion is installed
ansible.builtin.apt: name=bash-completion ansible.builtin.apt:
name: "bash-completion"
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10

View file

@ -6,9 +6,11 @@
register: gcloud_status register: gcloud_status
- name: gcloud | Archive | Get gcloud_status - name: gcloud | Archive | Get gcloud_status
ansible.builtin.debug: var=gcloud_status ansible.builtin.debug:
var: "gcloud_status"
- name: gcloud | Archive | Set installed version if installation exists - name: gcloud | Archive | Set installed version if installation exists
when: gcloud_status.stat.exists
block: block:
- name: gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }} - name: gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }}
ansible.builtin.slurp: ansible.builtin.slurp:
@ -21,17 +23,16 @@
ansible.builtin.debug: ansible.builtin.debug:
msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed" msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed"
- name: gcloud | Archive | Version already installed - name: gcloud | Archive | Version already installed
when: gcloud_version == gcloud_installed_version
ansible.builtin.debug: ansible.builtin.debug:
msg: >- msg: >-
Skipping installation of google-cloud-sdk version {{ gcloud_version }} when Skipping installation of google-cloud-sdk version {{ gcloud_version }} when
{{ gcloud_installed_version }} is already installed. {{ gcloud_installed_version }} is already installed.
when: gcloud_version == gcloud_installed_version
when: gcloud_status.stat.exists
- name: gcloud | Archive | Start installation - name: gcloud | Archive | Start installation
ansible.builtin.include_tasks: archive_install.yml
when: gcloud_installed_version is undefined or when: gcloud_installed_version is undefined or
gcloud_version is version(gcloud_installed_version, '>') gcloud_version is version(gcloud_installed_version, '>')
ansible.builtin.include_tasks: archive_install.yml
- name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 - name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301
ansible.builtin.command: gcloud components install {{ item }} ansible.builtin.command: gcloud components install {{ item }}

View file

@ -12,14 +12,18 @@
filename: google-cloud-sdk filename: google-cloud-sdk
- name: gcloud | Debian | Install the google-cloud-sdk package - name: gcloud | Debian | Install the google-cloud-sdk package
ansible.builtin.apt: name=google-cloud-sdk update_cache=yes ansible.builtin.apt:
name: "google-cloud-sdk"
update_cache: "yes"
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10
delay: 2 delay: 2
- name: gcloud | Debian | Install the google-cloud-sdk additional components - name: gcloud | Debian | Install the google-cloud-sdk additional components
ansible.builtin.apt: name=google-cloud-sdk-{{ item }} update_cache=yes ansible.builtin.apt:
name: "google-cloud-sdk-{{ item }}"
update_cache: "yes"
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10

View file

@ -13,14 +13,18 @@
- https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
- name: gcloud | RHEL | Install the google-cloud-sdk package - name: gcloud | RHEL | Install the google-cloud-sdk package
ansible.builtin.yum: name=google-cloud-sdk update_cache=yes ansible.builtin.yum:
name: "google-cloud-sdk"
update_cache: "yes"
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10
delay: 2 delay: 2
- name: gcloud | Debian | Install the google-cloud-sdk additional components - name: gcloud | Debian | Install the google-cloud-sdk additional components
ansible.builtin.yum: name=google-cloud-sdk-{{ item }} update_cache=yes ansible.builtin.yum:
name: "google-cloud-sdk-{{ item }}"
update_cache: "yes"
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10

View file

@ -0,0 +1,20 @@
---
galaxy_info:
role_name: gcsfuse
author: Eric Anderson
description: Ansible role to install gcsfuse
license: GPL-3.0
min_ansible_version: "2.9"
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- bionic
galaxy_tags:
- gcloud
- google
- gcsfuse
- fuse
dependencies: []

View file

@ -1,6 +1,7 @@
--- ---
- name: gcsfuse | Ensure gpg is installed - name: gcsfuse | Ensure gpg is installed
ansible.builtin.apt: name=gnupg ansible.builtin.apt:
name: "gnupg"
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10
@ -18,7 +19,9 @@
filename: gcsfuse filename: gcsfuse
- name: gcsfuse | Install gcsfuse - name: gcsfuse | Install gcsfuse
ansible.builtin.apt: name=gcsfuse update_cache=yes ansible.builtin.apt:
name: "gcsfuse"
update_cache: "yes"
register: task_result register: task_result
until: task_result is success until: task_result is success
retries: 10 retries: 10

View file

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