feat(netbird): плейбук и манифесты панели для запуска из Gitea

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
karpenokandCursor committed 2026-11-08 00:51:28 +07:00
1 parent 4a23e17290
commit a1573775ef
12 files changed
+491 -24

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
name: netbird-install
on:
workflow_dispatch:
inputs:
letsencrypt_email:
description: Почта для уведомлений Let's Encrypt
required: true
type: string
jobs:
install:
runs-on: homelab
timeout-minutes: 30
steps:
- name: Запустить плейбук NetBird
env:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
NETBIRD_LETSENCRYPT_EMAIL: ${{ inputs.letsencrypt_email }}
run: |
set -eu
if [ -z "${RUNNER_SSH_KEY}" ]; then
echo "В секретах нет RUNNER_SSH_KEY." >&2
exit 1
fi
if [ -z "${NETBIRD_LETSENCRYPT_EMAIL}" ]; then
echo "Укажите почту Let's Encrypt при запуске." >&2
exit 1
fi
if [ "$(id -u)" -eq 0 ]; then
apt-get update
apt-get install -y git openssh-client ansible-core
else
sudo apt-get update
sudo apt-get install -y git openssh-client ansible-core
fi
rm -rf /tmp/homelab-infra
git clone https://gitea.gunihome.ru/karpenok/homelab-infra.git /tmp/homelab-infra
sha="${GITHUB_SHA:-${GITEA_SHA:-}}"
if [ -n "${sha}" ]; then
git -C /tmp/homelab-infra checkout "${sha}"
fi
install -d -m 700 "${HOME}/.ssh"
printf '%s\n' "${RUNNER_SSH_KEY}" > "${HOME}/.ssh/id_ed25519"
chmod 600 "${HOME}/.ssh/id_ed25519"
ssh-keyscan -H central.gunihome.ru >> "${HOME}/.ssh/known_hosts"
printf '%s\n' "central.gunihome.ru" > /tmp/netbird-inventory.ini
ansible-playbook /tmp/homelab-infra/services/netbird/playbook.yml \
-i /tmp/netbird-inventory.ini \
-u root \
--private-key "${HOME}/.ssh/id_ed25519" \
-e "netbird_letsencrypt_email=${NETBIRD_LETSENCRYPT_EMAIL}"
ready=0
for _ in $(seq 1 30); do
code=$(curl -sk -o /dev/null -w '%{http_code}' https://central.gunihome.ru/ || true)
echo "https://central.gunihome.ru/ -> ${code}"
if [ "${code}" = "200" ] || [ "${code}" = "302" ]; then
ready=1
break
fi
sleep 10
done
if [ "${ready}" -ne 1 ]; then
echo "Панель не ответила по HTTPS за отведённое время." >&2
exit 1
fi