SWITCH: 从 Ansible 切换到 Terraform 管理 Nomad 配置
Some checks failed
Infrastructure CI/CD / Validate Infrastructure (push) Failing after 19s
Infrastructure CI/CD / Plan Infrastructure (push) Has been skipped
Infrastructure CI/CD / Apply Infrastructure (push) Has been skipped
Simple Test / test (push) Successful in 5s

- 创建 nomad-config Terraform 模块
- 声明式管理 Nomad 节点配置
- 更新 GitOps 工作流使用 Terraform
- 避免配置漂移,确保主客观统一
- 目标: 通过 IaC 修复 5个异常节点
This commit is contained in:
2025-10-09 13:15:57 +00:00
parent ea85f807d0
commit 45f93cc68c
4 changed files with 109 additions and 4 deletions

View File

@@ -21,11 +21,17 @@ jobs:
sudo apt update
sudo apt install -y ansible
- name: Deploy Nomad Configurations
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.5.0"
- name: Deploy Nomad Configurations with Terraform
run: |
echo "修复 Nomad 节点配置..."
cd ansible
ansible-playbook -i inventory/hosts.yml fix-nomad-nodes.yml --limit "ch4,hcp1,warden,ash1d" -v
echo "使用 Terraform 管理 Nomad 配置..."
terraform init
terraform plan -out=tfplan
terraform apply -auto-approve tfplan
- name: Verify Deployment
run: |