From f4d6e537cc8329b2e26eca4dd8ff5355d566d572 Mon Sep 17 00:00:00 2001 From: karpenok Date: Mon, 9 Nov 2026 20:31:17 +0700 Subject: [PATCH] fix(ci): pass scoped TF_STATE_TOKEN to terraform http backend (GITEA_* secret names are reserved) --- .gitea/workflows/terraform.yml | 2 +- ansible/inventories/prod/group_vars/netbird.yml | 2 +- ansible/inventories/prod/hosts.yml | 8 +++++++- ansible/roles/host/tasks/main.yml | 6 +++++- terraform/pve/main.tf | 1 + terraform/pve/outputs.tf | 1 + terraform/pve/terraform.tfvars.example | 1 + terraform/pve/variables.tf | 1 + 8 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/terraform.yml b/.gitea/workflows/terraform.yml index 2ccfa77..abc5a2b 100644 --- a/.gitea/workflows/terraform.yml +++ b/.gitea/workflows/terraform.yml @@ -34,7 +34,7 @@ jobs: 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: ${{ inputs.target == 'netcore' && secrets.NETCORE_API_TOKEN || secrets.PVE_API_TOKEN }} RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }} - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN || github.token }} + GITEA_TOKEN: ${{ secrets.TF_STATE_TOKEN }} run: | set -eu diff --git a/ansible/inventories/prod/group_vars/netbird.yml b/ansible/inventories/prod/group_vars/netbird.yml index c123746..3473a14 100644 --- a/ansible/inventories/prod/group_vars/netbird.yml +++ b/ansible/inventories/prod/group_vars/netbird.yml @@ -1 +1 @@ -netbird_domain: central.myguni.ru +netbird_domain: central.gunihome.ru diff --git a/ansible/inventories/prod/hosts.yml b/ansible/inventories/prod/hosts.yml index 9ae2ba9..d0fa3ba 100644 --- a/ansible/inventories/prod/hosts.yml +++ b/ansible/inventories/prod/hosts.yml @@ -1,7 +1,13 @@ all: children: home: - hosts: {} + hosts: + core-net: + ansible_host: 192.168.1.104 + ansible_user: root + core_net: + hosts: + core-net: vps: # ВАЖНО # Поле ansible_password у внешних VPS — это одноразовый стартовый пароль от хостера diff --git a/ansible/roles/host/tasks/main.yml b/ansible/roles/host/tasks/main.yml index 7811dee..7188153 100644 --- a/ansible/roles/host/tasks/main.yml +++ b/ansible/roles/host/tasks/main.yml @@ -75,13 +75,17 @@ ansible.builtin.command: ufw allow OpenSSH register: ufw_ssh changed_when: "'added' in (ufw_ssh.stdout | lower)" + when: ansible_virtualization_type | default('') != 'lxc' - name: Проверить состояние firewall ansible.builtin.command: ufw status register: ufw_status changed_when: false + when: ansible_virtualization_type | default('') != 'lxc' - name: Включить firewall ansible.builtin.command: ufw --force enable - when: "'Status: active' not in ufw_status.stdout" + when: + - ansible_virtualization_type | default('') != 'lxc' + - "'Status: active' not in ufw_status.stdout" changed_when: true diff --git a/terraform/pve/main.tf b/terraform/pve/main.tf index 98a41db..eeb59fb 100644 --- a/terraform/pve/main.tf +++ b/terraform/pve/main.tf @@ -20,3 +20,4 @@ provider "proxmox" { agent = true } } + diff --git a/terraform/pve/outputs.tf b/terraform/pve/outputs.tf index 570ef7d..10668a9 100644 --- a/terraform/pve/outputs.tf +++ b/terraform/pve/outputs.tf @@ -1 +1,2 @@ # Выходные параметры для узла pve + diff --git a/terraform/pve/terraform.tfvars.example b/terraform/pve/terraform.tfvars.example index 2172cad..a984623 100644 --- a/terraform/pve/terraform.tfvars.example +++ b/terraform/pve/terraform.tfvars.example @@ -2,3 +2,4 @@ proxmox_endpoint = "https://192.168.1.2:8006/" proxmox_api_token = "root@pam!automation-stack=00000000-0000-0000-0000-000000000000" proxmox_insecure = true proxmox_node = "pve" + diff --git a/terraform/pve/variables.tf b/terraform/pve/variables.tf index d1cb498..483de70 100644 --- a/terraform/pve/variables.tf +++ b/terraform/pve/variables.tf @@ -30,3 +30,4 @@ variable "ssh_public_keys" { "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEpwqB40k8QQq3k8160gfMKDaCJCX9qzvmuijfe3mO4I gitea-runner" ] } +