OpenVPN Ansible / Ansible Syntax Check (push) Failing after 49s
OpenVPN Ansible / Ansible Lint (push) Failing after 49s
OpenVPN Ansible / Deploy OpenVPN (push) Skipped
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
169 lines
3.8 KiB
YAML
169 lines
3.8 KiB
YAML
name: OpenVPN Ansible
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
ansible-lint:
|
|
name: Ansible Lint
|
|
runs-on: hetzner-ubuntu-latest
|
|
|
|
container:
|
|
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run ansible-lint
|
|
run: ansible-lint
|
|
|
|
|
|
syntax-check:
|
|
name: Ansible Syntax Check
|
|
runs-on: hetzner-ubuntu-latest
|
|
|
|
container:
|
|
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Syntax check
|
|
env:
|
|
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
|
|
run: |
|
|
ansible-playbook --syntax-check playbooks/openvpn.yml
|
|
|
|
|
|
deploy-prod:
|
|
name: Deploy OpenVPN
|
|
runs-on: hetzner-ubuntu-latest
|
|
|
|
needs:
|
|
- ansible-lint
|
|
- syntax-check
|
|
|
|
container:
|
|
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup SSH
|
|
run: |
|
|
echo "Setting up SSH ..."
|
|
mkdir -p ~/.ssh
|
|
printf '%s\n' '${{ secrets.SSH_PRIVATE_KEY }}' > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh-keygen -y -f ~/.ssh/id_ed25519 > /dev/null
|
|
echo "SSH key configured successfully"
|
|
|
|
- name: Deploy
|
|
env:
|
|
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
|
|
run: |
|
|
ansible-playbook playbooks/openvpn.yml
|
|
|
|
|
|
sbom:
|
|
name: Generate SBOM
|
|
runs-on: hetzner-ubuntu-latest
|
|
|
|
needs:
|
|
- deploy-prod
|
|
|
|
container:
|
|
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup SSH
|
|
run: |
|
|
echo "Setting up SSH ..."
|
|
mkdir -p ~/.ssh
|
|
printf '%s\n' '${{ secrets.SSH_PRIVATE_KEY }}' > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh-keygen -y -f ~/.ssh/id_ed25519 > /dev/null
|
|
echo "SSH key configured successfully"
|
|
|
|
- name: Generate SBOM
|
|
env:
|
|
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
|
|
run: |
|
|
ansible-playbook playbooks/sbom.yml
|
|
|
|
- name: Upload SBOM
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sbom
|
|
path: reports/sbom/
|
|
retention-days: 365
|
|
|
|
|
|
trivy-sbom:
|
|
name: Scan SBOM with Trivy
|
|
runs-on: hetzner-ubuntu-latest
|
|
|
|
needs:
|
|
- sbom
|
|
|
|
container:
|
|
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download SBOM
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: sbom
|
|
path: reports/sbom/
|
|
|
|
- name: Scan SBOMs
|
|
run: |
|
|
ls -R reports || true
|
|
|
|
mkdir -p reports/trivy
|
|
|
|
if compgen -G "reports/sbom/*.json" > /dev/null; then
|
|
|
|
for sbom in reports/sbom/*.json; do
|
|
filename=$(basename "$sbom" .json)
|
|
|
|
echo "Scanning $sbom"
|
|
|
|
trivy sbom \
|
|
--format json \
|
|
--output "reports/trivy/${filename}-trivy.json" \
|
|
--exit-code 0 \
|
|
"$sbom"
|
|
|
|
trivy sbom \
|
|
--format table \
|
|
--output "reports/trivy/${filename}-trivy.txt" \
|
|
--exit-code 0 \
|
|
"$sbom"
|
|
done
|
|
|
|
else
|
|
echo "No SBOM files found."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Upload Trivy reports
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: trivy-reports
|
|
path: reports/trivy/
|
|
retention-days: 365
|