REMOVE: 删除不再使用的 Terraform 配置文件
Some checks failed
Deploy Nomad Configurations / deploy-nomad (push) Failing after 7m45s
Infrastructure CI/CD / Validate Infrastructure (push) Failing after 2m33s
Infrastructure CI/CD / Plan Infrastructure (push) Has been skipped
Infrastructure CI/CD / Apply Infrastructure (push) Has been skipped
Simple Test / test (push) Failing after 2m48s
Some checks failed
Deploy Nomad Configurations / deploy-nomad (push) Failing after 7m45s
Infrastructure CI/CD / Validate Infrastructure (push) Failing after 2m33s
Infrastructure CI/CD / Plan Infrastructure (push) Has been skipped
Infrastructure CI/CD / Apply Infrastructure (push) Has been skipped
Simple Test / test (push) Failing after 2m48s
- 移除 nomad-terraform.tf 和 test_opentofu_consul.tf 文件 - 更新 Ansible inventory,注释掉不存在的节点 hcp2 - 修改 inventory.ini,确保节点配置的准确性 - 在 nomad-config 模块中添加 null_provider 以支持新配置 - 更新 influxdb1.hcl,添加 Grafana 和 Prometheus 数据卷配置
This commit is contained in:
45
test-tofu-local/test-local.tf
Normal file
45
test-tofu-local/test-local.tf
Normal file
@@ -0,0 +1,45 @@
|
||||
# 测试 OpenTofu 本机功能
|
||||
terraform {
|
||||
required_providers {
|
||||
null = {
|
||||
source = "registry.opentofu.org/hashicorp/null"
|
||||
version = "3.2.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 本机测试 - 创建文件
|
||||
resource "null_resource" "local_test" {
|
||||
provisioner "local-exec" {
|
||||
command = <<EOF
|
||||
echo "=== 基线测试:模拟完整的配置替换流程 ==="
|
||||
echo "时间: $(date)"
|
||||
|
||||
echo "1. 模拟上传配置文件..."
|
||||
cp ../nomad-configs-tofu/onecloud1-server.hcl /tmp/nomad-test.hcl
|
||||
echo " 配置文件已复制到 /tmp/nomad-test.hcl"
|
||||
|
||||
echo "2. 模拟替换运行配置..."
|
||||
sudo mkdir -p /tmp/test-nomad.d
|
||||
sudo cp /tmp/nomad-test.hcl /tmp/test-nomad.d/nomad.hcl
|
||||
echo " 配置已替换到 /tmp/test-nomad.d/nomad.hcl"
|
||||
|
||||
echo "3. 模拟服务重启..."
|
||||
sleep 2
|
||||
echo " 服务重启完成 (模拟)"
|
||||
|
||||
echo "4. 验证配置..."
|
||||
ls -la /tmp/test-nomad.d/
|
||||
echo "=== 基线测试完成 - 总耗时应该在2-3秒 ==="
|
||||
echo "完成时间: $(date)"
|
||||
EOF
|
||||
}
|
||||
|
||||
triggers = {
|
||||
test_run = timestamp()
|
||||
}
|
||||
}
|
||||
|
||||
output "test_result" {
|
||||
value = "本机测试完成"
|
||||
}
|
||||
Reference in New Issue
Block a user