infra-setup (#2)
Some checks failed
Infrastructure / Check infrastructure definitions (push) Successful in 1m33s
Infrastructure / Deploy modified infrastructure (push) Failing after 1m36s

Reviewed-on: #2
This commit is contained in:
2023-09-02 17:54:03 +00:00
parent 81eb9300fb
commit 7db11c6506
4 changed files with 102 additions and 1 deletions

65
.github/workflows/infra.yaml vendored Normal file
View File

@@ -0,0 +1,65 @@
name: Infrastructure
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- infra/**
paths:
- infra/**-playbook.yaml
- .github/workflows/infra.yaml
fork:
jobs:
check:
name: Check infrastructure definitions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip3 install -r requirements.txt
ansible-galaxy collection install community.general
- name: Check modified playbooks
run: |
find . -wholename "*/infra/*-playbook.yaml" -type f -exec ansible-playbook --inventory ./inventory --check {} \;
deploy:
name: Deploy modified infrastructure
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip3 install -r requirements.txt
ansible-galaxy collection install community.general
- name: Get changed files
id: files
uses: tj-actions/changed-files@v38
- name: Run changed playbooks
run: |
for file in ${{ steps.files.outputs.all_changed_files }}; do
ansible-playbook --inventory ./inventory "$file"
done