89luca89 / 89luca89/terrible

[IMPROVEMENT] Improve inventory defaults

未關閉
#91 0 則留言 0 個 reaction 已指派 1 人 已被 @89luca89 認領 在 GitHub 檢視
enhancement experimental help wanted refactoring
主要語言
YAML
星號
259
分支
29
PR 合併指標
30 天內沒有已合併 PR

描述

Right now, setting up a VM can be quite a bit of YAML code, so we should improve this giving better and sane defaults for all aspects of a VM

Right now we could improve setting up:

1. if only 1 network is defined, it's `default_route` by default
2. if only 1 network is defined, DNS and Gateway will default to xxx.xxx.xxx.1
3. if only 1 network is defined, IP should default to `ansible_host`
3. if a disk is declared, it will default to the first FStype (ext4, ufs, etc...)
4. if a disk is declared, it will default mount to `/mnt/${ disk name }`
5. if a disk is declared, it will default to the `pool_name`
6. if a disk is declared, and it's a `swap` it should default `mount_point` to `none` without having to declare it
7. `pool_name` should default to `default`
8. if only 1 hypervisor is declared, VMs should default to it.

Ideally a simple inventory without many variables should be able to declare VMs in a simple manner like:

```yaml
all:
vars:
disk_source: "/mnt/template.qcow2"
os_family: RedHat
hosts:
terraform_node:
ansible_host: localhost
ansible_connection: local
hypervisor_1:
ansible_host: 10.90.20.12
ansible_user: root
children:
deploy:
children:
my_nodes:
hosts:
node-0:
cpu: 2
memory: 2512
ansible_host: 192.168.122.200
data_disks:
disk-1:
size: 5
...

```

Or even simpler if no external disks are declared

```yaml
all:
vars:
disk_source: "/mnt/template.qcow2"
os_family: RedHat
hosts:
terraform_node:
ansible_host: localhost
ansible_connection: local
hypervisor_1:
ansible_host: 10.90.20.12
ansible_user: root
children:
deploy:
children:
my_nodes:
hosts:
node-0:
cpu: 2
memory: 2512
ansible_host: 192.168.122.200
node-1:
cpu: 2
memory: 2512
ansible_host: 192.168.122.201

....
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

查看 playbook 中解析 inventory 和設定 VM 的程式碼,可能位於 roles 或 tasks 目錄中。了解目前如何設定 network、disk 和 hypervisor 的預設值。建立一個最小的 inventory YAML 並執行 playbook 來測試變更,驗證預設值是否正確套用。

由索引模型根據 Issue 內容生成。

評估

領域
infrastructure
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。