refctor: rework ci to ue ansible-lint and fix molecule
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful

This commit is contained in:
Robert Kaussow 2024-08-19 16:06:03 +02:00
parent 227d56d650
commit a5e1e6f8b0
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
10 changed files with 52 additions and 42 deletions

View File

@ -1,18 +0,0 @@
---
ansible:
custom_modules:
- iptables_raw
- openssl_pkcs12
- proxmox_kvm
- ucr
- corenetworks_dns
- corenetworks_token
rules:
exclude_files:
- "LICENSE*"
- "**/*.md"
- "**/*.ini"
warning_filter:
- ANS126

View File

@ -9,11 +9,11 @@ steps:
- name: generate - name: generate
image: quay.io/thegeeklab/ansible-doctor image: quay.io/thegeeklab/ansible-doctor
environment: environment:
ANSIBLE_DOCTOR_EXCLUDE_FILES: molecule/ ANSIBLE_DOCTOR_EXCLUDE_FILES: "['molecule/']"
ANSIBLE_DOCTOR_FORCE_OVERWRITE: "true" ANSIBLE_DOCTOR_RENDERER__FORCE_OVERWRITE: "true"
ANSIBLE_DOCTOR_LOG_LEVEL: INFO ANSIBLE_DOCTOR_LOGGING__LEVEL: info
ANSIBLE_DOCTOR_ROLE_NAME: ${CI_REPO_NAME} ANSIBLE_DOCTOR_ROLE__NAME: ${CI_REPO_NAME}
ANSIBLE_DOCTOR_TEMPLATE: readme ANSIBLE_DOCTOR_TEMPLATE__NAME: readme
- name: format - name: format
image: quay.io/thegeeklab/alpine-tools image: quay.io/thegeeklab/alpine-tools

View File

@ -6,10 +6,10 @@ when:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
steps: steps:
- name: ansible-later - name: ansible-lint
image: quay.io/thegeeklab/ansible-later:4 image: quay.io/thegeeklab/ansible-dev-tools:1
commands: commands:
- ansible-later - ansible-lint
environment: environment:
FORCE_COLOR: "1" FORCE_COLOR: "1"

View File

@ -7,7 +7,7 @@ when:
variables: variables:
- &molecule_base - &molecule_base
image: quay.io/thegeeklab/molecule:6 image: quay.io/thegeeklab/ansible-dev-tools:1
group: molecule group: molecule
environment: environment:
PY_COLORS: "1" PY_COLORS: "1"

20
.yamllint Normal file
View File

@ -0,0 +1,20 @@
---
extends: default
rules:
truthy:
allowed-values: ["True", "False"]
comments:
min-spaces-from-content: 1
comments-indentation: False
line-length: disable
braces:
min-spaces-inside: 0
max-spaces-inside: 1
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
indentation: enable
octal-values:
forbid-implicit-octal: True
forbid-explicit-octal: True

View File

@ -3,14 +3,14 @@
ansible.builtin.service: ansible.builtin.service:
name: k3s name: k3s
state: restarted state: restarted
daemon_reload: yes daemon_reload: True
enabled: yes enabled: True
listen: __k3s_restart listen: __k3s_restart
- name: Restart iscsid service - name: Restart iscsid service
ansible.builtin.service: ansible.builtin.service:
name: iscsid name: iscsid
state: restarted state: restarted
daemon_reload: yes daemon_reload: True
enabled: yes enabled: True
listen: __iscsid_restart listen: __iscsid_restart

View File

@ -4,11 +4,11 @@ driver:
dependency: dependency:
name: galaxy name: galaxy
options: options:
role-file: molecule/requirements.yml role-file: requirements.yml
requirements-file: molecule/requirements.yml requirements-file: requirements.yml
platforms: platforms:
- name: "rocky9-k3s" - name: "rocky9-k3s"
server_type: "CX22" server_type: "cx22"
image: "rocky-9" image: "rocky-9"
provisioner: provisioner:
name: ansible name: ansible

View File

@ -1,5 +1,7 @@
--- ---
collections: [] collections:
- name: ansible.posix
- name: kubernetes.core
roles: roles:
- src: https://gitea.rknet.org/ansible/xoxys.kernel - src: https://gitea.rknet.org/ansible/xoxys.kernel

View File

@ -6,7 +6,7 @@
failed_when: False failed_when: False
- name: Clean previous runs of k3s-init - name: Clean previous runs of k3s-init
ansible.builtin.command: systemctl reset-failed k3s-init ansible.builtin.command: systemctl reset-failed k3s-init # noqa command-instead-of-module
failed_when: False failed_when: False
changed_when: False changed_when: False
tags: tags:
@ -23,7 +23,8 @@
creates: "{{ __k3s_service_file }}" creates: "{{ __k3s_service_file }}"
register: __k3s_init register: __k3s_init
- when: __k3s_init.changed | bool - name: Wait for k3s-init to finish
when: __k3s_init.changed | bool # noqa no-handler
block: block:
- name: Verify that all nodes actually joined - name: Verify that all nodes actually joined
ansible.builtin.command: >- ansible.builtin.command: >-

View File

@ -1,9 +1,14 @@
--- ---
- ansible.builtin.include_tasks: reset.yml - name: Reset k3s
ansible.builtin.include_tasks: reset.yml
when: k3s_reset | bool when: k3s_reset | bool
- ansible.builtin.include_tasks: prepare.yml - name: Prepare k3s
- ansible.builtin.include_tasks: init.yml ansible.builtin.include_tasks: prepare.yml
- name: Initialize cluster
ansible.builtin.include_tasks: init.yml
when: k3s_server | bool when: k3s_server | bool
- ansible.builtin.include_tasks: setup.yml - name: Setup k3s
- ansible.builtin.include_tasks: iscsi.yml ansible.builtin.include_tasks: setup.yml
- name: Setup iscsi
ansible.builtin.include_tasks: iscsi.yml
when: k3s_iscsi_enabled | bool when: k3s_iscsi_enabled | bool