iac_modules/terraform-hcl-standard/vultr-vps/config/resources/ai-workspace-hosts.yaml
Haitao Pan 3a8065e6f0 refactor(vultr-vps): split declaration / shared templates / shared scripts
- config/resources/ai-workspace-hosts.yaml: resource declaration (moved from env)
- templates/: shared provider.tf, variables.tf, cloud-init.yaml + hosts.tf.j2,
  inventory.ini.j2 (render copies the .tf/config into the env workdir)
- scripts/generate.py + provision.sh: shared composition logic, parameterized
  by --resources/--workdir (no longer duplicated per env)
- envs/ai-workspace/: degraded to a terraform workdir (only README/.gitignore
  tracked; rendered artifacts + tfstate gitignored)
- AGENTS.md + terraform-yaml-render-pattern skill updated to the layered layout

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 21:21:45 +08:00

48 lines
1.9 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.

# =============================================================================
# ai-workspace 资源描述 (CMDB 源数据)
#
# 这是唯一的人工维护入口。generate.py 读取本文件:
# - global 段 -> terraform.auto.tfvars.json (传给 variables.tf)
# - ssh_keys -> generated_hosts.tf 里的显式 vultr_ssh_key 资源块
# - hosts -> generated_hosts.tf 里逐主机的显式 module/data 块 (无 for_each)
#
# 改完 YAML 后执行: python3 generate.py render
# =============================================================================
global:
region: nrt # 默认区域:东京。可选 ewr/sgp/fra ...
name_prefix: ai-workspace
user_data_file: cloud-init.yaml
# 注入实例的登录公钥(公钥非敏感,可入库;私钥/API Key 不要写这里)
ssh_keys:
- name: ai-workspace-admin
public: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO37O6S1Kf0QRV3/hQ7OVGZetEEcP7AevwXrRi8HRpHg ai-workspace-vultr"
# 主机清单。map key 风格用 name 字段;每台机器渲染成一个独立 module 块。
hosts:
- name: ai-debian13
os_name: "Debian 13 x64 (trixie)" # Vultr 实际镜像名(含 trixie也可写 os_id: 2625
plan: vc2-4c-8gb # 4 核 8G
backups: false # 不开备份
enable_ipv6: true # 公网 IPv4 默认分配,这里附带开 IPv6
ansible_user: root
groups: [ai_workspace, debian]
tags: [debian13]
host_vars:
role: primary
# 逗号分隔的服务域名cloudflare_dns 角色据此为本机 IP 建 A 记录
service_domains: ai-debian13.svc.plus
- name: ai-ubuntu2604
os_name: "Ubuntu 26.04 LTS x64"
plan: vc2-4c-8gb
backups: false
enable_ipv6: true
ansible_user: root
groups: [ai_workspace, ubuntu]
tags: [ubuntu2604]
host_vars:
role: secondary
service_domains: ai-ubuntu2604.svc.plus