ansible-deploy / plan (push) Successful in 1s
ansible-lint / lint (push) Successful in 2s
ansible-deploy / deploy (core-mon, ) (push) Successful in 37s
ansible-deploy / deploy (core-net, ) (push) Failing after 52s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 24s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 1m20s
ansible-deploy / deploy (opnsense, ) (push) Successful in 13s
ansible-deploy / deploy (rus-central, ) (push) Successful in 1m6s
Повторный прогон без смены compose не тянет образы, ноды и сквады добавляются данными, а не новым плейбуком на каждый VPS. Co-authored-by: Cursor <cursoragent@cursor.com>
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
name: ansible-deploy
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
- main
|
||
paths:
|
||
- 'ansible/**'
|
||
paths-ignore:
|
||
- 'ansible/ci/**'
|
||
workflow_dispatch:
|
||
inputs:
|
||
machine:
|
||
description: 'Машина: all, имя плейбука или хост группы remnanodes (имя с -nod-)'
|
||
required: true
|
||
default: 'all'
|
||
type: string
|
||
tags:
|
||
description: 'Необязательный фильтр тегов (например: remnawave, netbird, monitoring)'
|
||
required: false
|
||
default: ''
|
||
type: string
|
||
|
||
jobs:
|
||
plan:
|
||
runs-on: homelab
|
||
container:
|
||
image: homelab-ansible:latest
|
||
outputs:
|
||
matrix: ${{ steps.calc.outputs.matrix }}
|
||
has_targets: ${{ steps.calc.outputs.has_targets }}
|
||
steps:
|
||
- name: Вычислить затронутые машины
|
||
id: calc
|
||
env:
|
||
EVENT_NAME: ${{ github.event_name }}
|
||
EVENT_BEFORE: ${{ github.event.before }}
|
||
EVENT_SHA: ${{ github.sha }}
|
||
INPUT_MACHINE: ${{ inputs.machine || 'all' }}
|
||
INPUT_TAGS: ${{ inputs.tags || '' }}
|
||
run: |
|
||
set -eu
|
||
rm -rf "${HOME}/homelab-infra"
|
||
git clone http://192.168.1.105:3000/karpenok/homelab-infra.git "${HOME}/homelab-infra"
|
||
sha="${GITHUB_SHA:-${GITEA_SHA:-}}"
|
||
if [ -n "${sha}" ]; then
|
||
git -C "${HOME}/homelab-infra" checkout "${sha}"
|
||
fi
|
||
python3 "${HOME}/homelab-infra/ansible/ci/ansible-plan.py"
|
||
|
||
deploy:
|
||
needs: plan
|
||
if: needs.plan.outputs.has_targets == 'true'
|
||
runs-on: homelab
|
||
container:
|
||
image: homelab-ansible:latest
|
||
timeout-minutes: 45
|
||
strategy:
|
||
fail-fast: false
|
||
max-parallel: 1
|
||
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
|
||
steps:
|
||
- name: Деплой ${{ matrix.machine }}
|
||
env:
|
||
INFISICAL_CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
|
||
INFISICAL_CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
||
run: |
|
||
set -eu
|
||
rm -rf "${HOME}/homelab-infra"
|
||
git clone http://192.168.1.105:3000/karpenok/homelab-infra.git "${HOME}/homelab-infra"
|
||
sha="${GITHUB_SHA:-${GITEA_SHA:-}}"
|
||
if [ -n "${sha}" ]; then
|
||
git -C "${HOME}/homelab-infra" checkout "${sha}"
|
||
fi
|
||
chmod -R go-w "${HOME}/homelab-infra"
|
||
exec bash "${HOME}/homelab-infra/ansible/ci/deploy-machine.sh" \
|
||
"${{ matrix.machine }}" "${{ github.event_name }}" "${{ github.event.before }}" "${{ github.sha }}" "${{ matrix.tags }}"
|
||
|