refactor(terraform): structure directories by hypervisor (netcore/ and pve/)
This commit is contained in:
1 parent
2b23809bc3
commit
2bc77b50f4
11 files changed
+105
-7
No files matched your search
@@ -3,6 +3,14 @@ name: terraform-proxmox
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target:
|
||||
description: 'Целевой узел Proxmox'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- netcore
|
||||
- pve
|
||||
default: netcore
|
||||
action:
|
||||
description: 'Действие Terraform (plan / apply)'
|
||||
required: true
|
||||
@@ -19,16 +27,22 @@ jobs:
|
||||
image: homelab-ansible:latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Выполнить Terraform для Proxmox (netcore)
|
||||
- name: Выполнить Terraform
|
||||
env:
|
||||
TF_VAR_proxmox_endpoint: ${{ secrets.PVE_ENDPOINT || 'https://192.168.1.100:8006/' }}
|
||||
TARGET: ${{ inputs.target }}
|
||||
ACTION: ${{ inputs.action }}
|
||||
TF_VAR_proxmox_endpoint: ${{ inputs.target == 'netcore' && (secrets.NETCORE_ENDPOINT || 'https://192.168.1.100:8006/') || (secrets.PVE_ENDPOINT || 'https://192.168.1.2:8006/') }}
|
||||
TF_VAR_proxmox_api_token: ${{ secrets.PVE_API_TOKEN }}
|
||||
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
|
||||
ACTION: ${{ inputs.action }}
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
# Гарантированный резолв локальной Gitea внутри Docker-раннера
|
||||
if ! grep -q "gitea.gunihome.ru" /etc/hosts; then
|
||||
echo "192.168.1.201 gitea.gunihome.ru" >> /etc/hosts
|
||||
fi
|
||||
|
||||
rm -rf "${HOME}/homelab-infra"
|
||||
git clone https://gitea.gunihome.ru/karpenok/homelab-infra.git "${HOME}/homelab-infra"
|
||||
sha="${GITHUB_SHA:-${GITEA_SHA:-}}"
|
||||
@@ -45,12 +59,12 @@ jobs:
|
||||
trap 'rm -f "${HOME}/.ssh/id_ed25519"' EXIT
|
||||
fi
|
||||
|
||||
cd "${HOME}/homelab-infra/terraform"
|
||||
cd "${HOME}/homelab-infra/terraform/${TARGET}"
|
||||
|
||||
terraform init \
|
||||
-backend-config="address=https://gitea.gunihome.ru/api/v1/packages/karpenok/terraform/state/netcore" \
|
||||
-backend-config="lock_address=https://gitea.gunihome.ru/api/v1/packages/karpenok/terraform/state/netcore/lock" \
|
||||
-backend-config="unlock_address=https://gitea.gunihome.ru/api/v1/packages/karpenok/terraform/state/netcore/lock" \
|
||||
-backend-config="address=https://gitea.gunihome.ru/api/v1/packages/karpenok/terraform/state/${TARGET}" \
|
||||
-backend-config="lock_address=https://gitea.gunihome.ru/api/v1/packages/karpenok/terraform/state/${TARGET}/lock" \
|
||||
-backend-config="unlock_address=https://gitea.gunihome.ru/api/v1/packages/karpenok/terraform/state/${TARGET}/lock" \
|
||||
-backend-config="username=karpenok" \
|
||||
-backend-config="password=${GITEA_TOKEN}" \
|
||||
-backend-config="lock_method=POST" \
|
||||
|
||||
Reference in new issue
Block a user