Skip to content

Commit

Permalink
Update workflows, fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mddamato authored and Michael DAmato committed Apr 12, 2023
1 parent 51bdf95 commit 401a606
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file contains ignores rule violations for ansible-lint

roles/testing/tasks/troubleshooting.yml ignore-errors
7 changes: 3 additions & 4 deletions .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CentOS 7

on:
pull_request:
push:
workflow_dispatch:

env:
Expand All @@ -19,10 +18,10 @@ jobs:

steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.7.
uses: actions/setup-python@v2
- name: Set up Python.
uses: actions/setup-python@v4
with:
python-version: '3.x'

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: CentOS 7

on:
push:

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

jobs:

lint-test:
name: Lint for push
runs-on: ubuntu-latest

steps:
- name: Check out the codebase.
uses: actions/checkout@v3

- name: Set up Python.
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install yamllint ansible-lint ansible

- name: Version check
run: |
ansible --version
ansible-lint --version
yamllint --version
- name: Run yamllint.
run: yamllint .

- name: Run ansible-lint.
run: ansible-lint
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.7.
uses: actions/setup-python@v2
- name: Set up Python.
uses: actions/setup-python@v4
with:
python-version: '3.x'

Expand Down
15 changes: 10 additions & 5 deletions roles/rke2_common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,23 @@
and not installed
- name: RHEL/CentOS Installation
when:
- ansible_os_family == 'RedHat' or ansible_os_family == 'Rocky'
- not rke2_binary_tarball_check.stat.exists
block:
- name: Install redhat-lsb-core
yum: name=redhat-lsb-core state=present
when: "'redhat-lsb-core' not in ansible_facts.packages"
yum:
name: redhat-lsb-core
state: present

- name: Reread ansible_lsb facts
setup: filter=ansible_lsb*
when: "'redhat-lsb-core' not in ansible_facts.packages"
setup:
filter: ansible_lsb*

- name: Include task file rpm_install.yml
include_tasks: rpm_install.yml
when:
- ansible_os_family == 'RedHat' or ansible_os_family == 'Rocky'
- not rke2_binary_tarball_check.stat.exists

# Disable Firewalld
# We recommend disabling firewalld. For Kubernetes 1.19+, firewalld must be turned off.
Expand Down
34 changes: 17 additions & 17 deletions roles/rke2_common/tasks/rpm_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
- name: "Calculate rke2 full version "
when: ( install_rke2_version is not defined ) or ( install_rke2_version | length == 0 ) # noqa var-spacing
block:
- name: Stop if the provided is not valid
fail:
msg: "Provided channel is not valid"
when: rke2_channel not in channels

- name: Get full version name url
uri:
url: https://update.rke2.io/v1-release/channels/{{ rke2_channel }}
follow_redirects: all
register: rke2_version_url

- name: Set full version name
shell: set -o pipefail && echo {{ rke2_version_url.url }} | sed -e 's|.*/||'
register: rke2_full_version
changed_when: false
args:
executable: /usr/bin/bash
- name: Stop if the provided is not valid
fail:
msg: "Provided channel is not valid"
when: rke2_channel not in channels

- name: Get full version name url
uri:
url: https://update.rke2.io/v1-release/channels/{{ rke2_channel }}
follow_redirects: all
register: rke2_version_url

- name: Set full version name
shell: set -o pipefail && echo {{ rke2_version_url.url }} | sed -e 's|.*/||'
register: rke2_full_version
changed_when: false
args:
executable: /usr/bin/bash

- name: Set rke2_full_version fact # noqa var-spacing
set_fact:
Expand Down
6 changes: 4 additions & 2 deletions site.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---

- hosts: rke2_servers
- name: Server play
hosts: rke2_servers
any_errors_fatal: true
become: true
roles:
- role: rke2_server
serial: 1

- hosts: rke2_agents
- name: Agent play
hosts: rke2_agents
any_errors_fatal: true
become: true
roles:
Expand Down
3 changes: 2 additions & 1 deletion testing.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: all
- name: Testing play
hosts: all
become: yes
roles:
- role: testing

0 comments on commit 401a606

Please sign in to comment.