Migrate host config from flat key-value to YAML format

This commit is contained in:
2026-05-13 15:11:05 +08:00
parent 1904288e9b
commit c810f4ef6c
6 changed files with 172 additions and 104 deletions
+37 -8
View File
@@ -42,13 +42,42 @@ tx-ubuntu-ubuntu # → 62.234.90.54 用户 ubuntu
tx-ubuntu-hugo # → 62.234.90.54 用户 hugo
```
文件内容:
YAML 格式(.yml 后缀),新建主机复制下面模板改:
```
HOST=<IP或域名>
USER=<SSH用户名>
PORT=<SSH端口>
KEY=keys/<密钥文件>.pem
```yaml
# ╔══════════════════════════════════════════════════╗
# ║ example · 示例主机 ║
# ╚══════════════════════════════════════════════════╝
host:
ip: 1.2.3.4
user: root
port: 22
key: keys/example.pem
info:
name: example-server
id: lhins-xxxxxxxx
status: 运行中
region:
city: 北京
zone: 北京七区
spec:
cpu: 4核
memory: 4GB
disk: SSD云硬盘 40GB
image: Ubuntu 24.04 LTS
network:
public_ip: 1.2.3.4
private_ip: 10.0.0.1
bandwidth: 3Mbps
traffic: 300GB/月
billing:
expire: 2027-01-01
auto_renew: false
```
### scripts/ — 脚本
@@ -77,8 +106,8 @@ KEY=keys/<密钥文件>.pem
# 1. 注册密钥
claw key add my-host C:\Users\me\Downloads\key.pem
# 2. 写主机描述
notepad hosts\my-host-ubuntu-root
# 2. 写主机描述 (YAML 格式)
notepad hosts\my-host-ubuntu-root.yml
# 3. 开工
claw ssh my-host-ubuntu-root