Implement ansible-lint workflow

This commit is contained in:
Paul Brinkmeier 2023-09-01 02:36:37 +02:00
parent 2006b9733e
commit 8fa1f674f9
3 changed files with 15 additions and 46 deletions

View File

@ -1,36 +0,0 @@
---
kind: pipeline
type: docker
name: Static Verification
steps:
- name: ansible-lint
image: python:3.10.6
commands:
# Make sure to update the ansible version below as well
- pip --disable-pip-version-check install ansible==7.2.0 ansible-lint==6.16.1 > /dev/null 2> /dev/null
- ansible-lint -c .ansible-lint ansible
---
kind: pipeline
type: docker
name: Check
steps:
- name: ansible-playbook --check
image: python:3.10.6
environment:
SSH_KEY:
from_secret: ssh_key
VAULT_PASSWORD:
from_secret: vault_password
commands:
- pip install ansible==7.2.0 > /dev/null 2> /dev/null
- mkdir "$HOME/.ssh"
- echo "$SSH_KEY" > "$HOME/.ssh/id"
- chmod 0600 ~/.ssh/id
- ssh-keyscan -p 2309 vmd98928.contaboserver.net > "$HOME/.ssh/known_hosts"
- echo "$VAULT_PASSWORD" > "$HOME/vault_password"
- cd ansible
- ansible-playbook --private-key "$HOME/.ssh/id" --vault-password-file "$HOME/vault_password" --check playbooks/misc-all.yaml

View File

@ -0,0 +1,15 @@
name: Check
on: [push]
jobs:
"Lint Ansible Files":
runs-on: ubuntu-22.04
steps:
- run: apt-get update
- run: apt-get install -y python3 python3-pip python3-venv
- run: python3 --version
- name: Check out repo
uses: actions/checkout@v3
- run: python3 -m venv venv
- run: venv/bin/pip --disable-pip-version-check install ansible==7.2.0 ansible-lint==6.16.1 > /dev/null 2> /dev/null
- run: venv/bin/ansible-lint -c .ansible-lint ansible
# TODO: Reimplement ansible-play --check step from old drone config

View File

@ -1,10 +0,0 @@
name: Lint Ansible files
run-name: "${{ gitea.actor }} is linting Ansible files!"
on: [push]
jobs:
lint-ansible-files:
runs-on: ubuntu-22.04
steps:
- run: echo "it works!"
- name: Check out repo
uses: actions/checkout@v3