ci: unify into matrix ansible-deploy.yml, add ansible-lint.yml and exit_nodes group
ansible-deploy / plan (push) Successful in 1s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 17s
ansible-lint / lint (push) Failing after 3s
ansible-deploy / deploy (core-mon, ) (push) Successful in 26s
ansible-deploy / deploy (core-net, ) (push) Successful in 52s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 1m18s
ansible-deploy / deploy (opnsense, ) (push) Successful in 9s
ansible-deploy / deploy (rus-central, ) (push) Successful in 52s

This commit is contained in:
karpenok committed 2026-11-15 22:44:34 +07:00
1 parent 189e31e266
commit fd0dcab300
18 files changed
+243 -278

No files matched your search

-37
View File
@@ -1,37 +0,0 @@
name: ansible-core-mon
on:
push:
branches:
- main
paths:
- 'ansible/roles/core-mon/**'
- 'ansible/roles/host/**'
- 'ansible/playbooks/core-mon.yml'
- 'ansible/playbooks/host.yml'
- 'ansible/inventories/prod/host_vars/core-mon.yml'
- 'ansible/inventories/prod/group_vars/**'
workflow_dispatch:
jobs:
deploy:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 30
steps:
- name: Деплой core-mon
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" core-mon "${{ github.event_name }}" "${{ github.event.before }}" "${{ github.sha }}"
-39
View File
@@ -1,39 +0,0 @@
name: ansible-core-net
on:
push:
branches:
- main
paths:
- 'ansible/roles/core-net/**'
- 'ansible/roles/agent_vault_service/**'
- 'ansible/roles/netbird_client/**'
- 'ansible/roles/vmagent/**'
- 'ansible/roles/host/**'
- 'ansible/playbooks/core-net.yml'
- 'ansible/playbooks/host.yml'
- 'ansible/inventories/prod/host_vars/core-net.yml'
- 'ansible/inventories/prod/group_vars/**'
workflow_dispatch:
jobs:
deploy:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 45
steps:
- name: Деплой core-net
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" core-net "${{ github.event_name }}" "${{ github.event.before }}" "${{ github.sha }}"
-37
View File
@@ -1,37 +0,0 @@
name: ansible-core-secrets
on:
push:
branches:
- main
paths:
- 'ansible/roles/core-secrets/**'
- 'ansible/roles/cadvisor/**'
- 'ansible/roles/host/**'
- 'ansible/playbooks/core-secrets.yml'
- 'ansible/playbooks/host.yml'
- 'ansible/inventories/prod/host_vars/core-secrets.yml'
- 'ansible/inventories/prod/group_vars/**'
workflow_dispatch:
jobs:
deploy:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 30
steps:
- name: Деплой core-secrets
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" core-secrets "${{ github.event_name }}" "${{ github.event.before }}" "${{ github.sha }}"
+85
View File
@@ -0,0 +1,85 @@
name: ansible-deploy
on:
push:
branches:
- main
paths:
- 'ansible/**'
paths-ignore:
- 'ansible/ci/**'
workflow_dispatch:
inputs:
machine:
description: 'Целевая машина (или all для полного прогона)'
required: true
default: 'all'
type: choice
options:
- all
- core-net
- core-secrets
- core-mon
- rus-central
- ger-nod-02
- opnsense
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 }}"
-39
View File
@@ -1,39 +0,0 @@
name: ansible-ger-nod-02
on:
push:
branches:
- main
paths:
- 'ansible/roles/netbird_exit_node/**'
- 'ansible/roles/remnanode/**'
- 'ansible/roles/netbird_client/**'
- 'ansible/roles/vmagent/**'
- 'ansible/roles/host/**'
- 'ansible/playbooks/ger-nod-02.yml'
- 'ansible/playbooks/host.yml'
- 'ansible/inventories/prod/host_vars/ger-nod-02.yml'
- 'ansible/inventories/prod/group_vars/**'
workflow_dispatch:
jobs:
deploy:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 45
steps:
- name: Деплой ger-nod-02
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" ger-nod-02 "${{ github.event_name }}" "${{ github.event.before }}" "${{ github.sha }}"
+33
View File
@@ -0,0 +1,33 @@
name: ansible-lint
on:
push:
branches:
- main
paths:
- 'ansible/**'
jobs:
lint:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 10
steps:
- name: Проверка синтаксиса скриптов, Python и плейбуков
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
cd "${HOME}/homelab-infra"
sh -n ansible/ci/ansible-target.sh
bash -n ansible/ci/deploy-machine.sh
python3 -m py_compile ansible/ci/ansible-plan.py \
ansible/roles/core-net/remnawave/files/sync_remnawave.py \
ansible/roles/rus-central/netbird/files/sync_access.py
cd ansible
ansible-playbook --syntax-check playbooks/*.yml
-35
View File
@@ -1,35 +0,0 @@
name: ansible-opnsense
on:
push:
branches:
- main
paths:
- 'ansible/roles/opnsense/**'
- 'ansible/playbooks/opnsense.yml'
- 'ansible/inventories/prod/host_vars/opnsense.yml'
- 'ansible/inventories/prod/group_vars/**'
workflow_dispatch:
jobs:
deploy:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 30
steps:
- name: Деплой opnsense
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" opnsense "${{ github.event_name }}" "${{ github.event.before }}" "${{ github.sha }}"
-45
View File
@@ -1,45 +0,0 @@
name: ansible-rus-central
on:
push:
branches:
- main
paths:
- 'ansible/roles/agent_vault_service/**'
- 'ansible/roles/rus-central/**'
- 'ansible/roles/cadvisor/**'
- 'ansible/roles/host/**'
- 'ansible/playbooks/rus-central.yml'
- 'ansible/playbooks/host.yml'
- 'ansible/inventories/prod/host_vars/rus-central.yml'
- 'ansible/inventories/prod/group_vars/**'
workflow_dispatch:
inputs:
letsencrypt_email:
description: Почта Let's Encrypt, если её нужно задать отдельно от group_vars
required: false
type: string
default: ""
jobs:
deploy:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 30
steps:
- name: Деплой rus-central
env:
INFISICAL_CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
INFISICAL_CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
INPUT_LETSENCRYPT_EMAIL: ${{ inputs.letsencrypt_email }}
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" rus-central "${{ github.event_name }}" "${{ github.event.before }}" "${{ github.sha }}"