Files
homelab-infra/.gitea/workflows/netbird-install.yml
T
karpenok d2888c1149
ansible-core-net / deploy (push) Failing after 4m59s
ansible-core-secrets / deploy (push) Failing after 1m50s
feat(secrets): integrate Infisical Universal Auth into Gitea Actions workflows
- Configure Infisical CLI authentication via INFISICAL_CLIENT_ID and INFISICAL_CLIENT_SECRET
- Fetch runner SSH keys and state tokens dynamically from /ci-cd
- Fetch Proxmox target endpoints and tokens dynamically from /proxmox/<TARGET>
- Remove plaintext secrets from Ansible core_secrets defaults
- Clean up obsolete files and add --remove-orphans to docker compose invocations
2026-11-10 11:58:44 +07:00

78 lines
2.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: netbird-install
on:
workflow_dispatch:
inputs:
letsencrypt_email:
description: Почта для уведомлений Let's Encrypt (по умолчанию из group_vars/all.yml)
required: false
type: string
default: 'vvkarpenok@gmail.com'
jobs:
install:
runs-on: homelab
container:
image: homelab-ansible:latest
timeout-minutes: 30
steps:
- name: Запустить плейбук NetBird
env:
INFISICAL_CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
INFISICAL_CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
NETBIRD_LETSENCRYPT_EMAIL: ${{ inputs.letsencrypt_email }}
run: |
set -eu
# Направляем домены на актуальный шлюз Traefik (core-net 192.168.1.104)
for domain in gitea.gunihome.ru infisical.gunihome.ru; do
if ! grep -q "${domain}" /etc/hosts; then
echo "192.168.1.104 ${domain}" >> /etc/hosts
fi
done
# Авторизация в Infisical и получение SSH-ключа
export INFISICAL_PROJECT_ID="806e7f09-5838-492a-946b-2d69b96876ab"
export INFISICAL_DOMAIN="https://infisical.gunihome.ru/api"
infisical login \
--domain="${INFISICAL_DOMAIN}" \
--method=universal-auth \
--client-id="${INFISICAL_CLIENT_ID}" \
--client-secret="${INFISICAL_CLIENT_SECRET}" \
--silent
eval "$(infisical export --domain="${INFISICAL_DOMAIN}" --env=prod --projectId="${INFISICAL_PROJECT_ID}" --path="/ci-cd" --format=dotenv-export --silent)"
if [ -z "${RUNNER_SSH_KEY:-}" ]; then
echo "В Infisical (/ci-cd) отсутствует RUNNER_SSH_KEY." >&2
exit 1
fi
rm -rf "${HOME}/homelab-infra"
git clone http://192.168.1.217: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"
install -d -m 700 "${HOME}/.ssh"
printf '%s\n' "${RUNNER_SSH_KEY}" > "${HOME}/.ssh/id_ed25519"
chmod 600 "${HOME}/.ssh/id_ed25519"
trap 'rm -f "${HOME}/.ssh/id_ed25519"' EXIT
export ANSIBLE_HOST_KEY_CHECKING=False
cd "${HOME}/homelab-infra/ansible"
extra_args=()
if [ -n "${NETBIRD_LETSENCRYPT_EMAIL:-}" ]; then
extra_args+=("-e" "netbird_letsencrypt_email=${NETBIRD_LETSENCRYPT_EMAIL}")
fi
ansible-playbook playbooks/site.yml \
-i inventories/prod/hosts.yml \
--limit netbird \
--private-key "${HOME}/.ssh/id_ed25519" \
"${extra_args[@]}"