feat(vmware): add hypervisor.node as unified placement field (replaces host)
This commit is contained in:
@@ -46,7 +46,7 @@ hypervisor_defaults:
|
|||||||
url: ""
|
url: ""
|
||||||
username: ""
|
username: ""
|
||||||
password: ""
|
password: ""
|
||||||
host: ""
|
node: ""
|
||||||
storage: ""
|
storage: ""
|
||||||
datacenter: ""
|
datacenter: ""
|
||||||
cluster: ""
|
cluster: ""
|
||||||
@@ -136,10 +136,10 @@ system_defaults:
|
|||||||
# All virtual types additionally require network bridge or interfaces.
|
# All virtual types additionally require network bridge or interfaces.
|
||||||
hypervisor_required_fields:
|
hypervisor_required_fields:
|
||||||
proxmox:
|
proxmox:
|
||||||
hypervisor: [url, username, password, host, storage]
|
hypervisor: [url, username, password, node, storage]
|
||||||
system: [id]
|
system: [id]
|
||||||
vmware:
|
vmware:
|
||||||
hypervisor: [url, username, password, datacenter, cluster, storage]
|
hypervisor: [url, username, password, datacenter, storage]
|
||||||
system: []
|
system: []
|
||||||
xen:
|
xen:
|
||||||
hypervisor: []
|
hypervisor: []
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
api_host: "{{ hypervisor_cfg.url }}"
|
api_host: "{{ hypervisor_cfg.url }}"
|
||||||
api_user: "{{ hypervisor_cfg.username }}"
|
api_user: "{{ hypervisor_cfg.username }}"
|
||||||
api_password: "{{ hypervisor_cfg.password }}"
|
api_password: "{{ hypervisor_cfg.password }}"
|
||||||
node: "{{ hypervisor_cfg.host }}"
|
node: "{{ hypervisor_cfg.node }}"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
- name: Normalize system inputs
|
- name: Normalize system inputs
|
||||||
|
|||||||
@@ -166,6 +166,23 @@
|
|||||||
label: "hypervisor.{{ item }}"
|
label: "hypervisor.{{ item }}"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
|
- name: Validate VMware placement (cluster or node required, mutually exclusive)
|
||||||
|
when:
|
||||||
|
- system_cfg.type == "virtual"
|
||||||
|
- hypervisor_type == "vmware"
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- >-
|
||||||
|
(hypervisor_cfg.cluster | default('') | string | length > 0)
|
||||||
|
or (hypervisor_cfg.node | default('') | string | length > 0)
|
||||||
|
- >-
|
||||||
|
(hypervisor_cfg.cluster | default('') | string | length == 0)
|
||||||
|
or (hypervisor_cfg.node | default('') | string | length == 0)
|
||||||
|
fail_msg: >-
|
||||||
|
VMware requires either hypervisor.cluster or hypervisor.node (mutually exclusive).
|
||||||
|
cluster targets a vSphere cluster; node targets a specific ESXi host.
|
||||||
|
quiet: true
|
||||||
|
|
||||||
- name: Validate hypervisor-specific required system fields
|
- name: Validate hypervisor-specific required system fields
|
||||||
when:
|
when:
|
||||||
- system_cfg.type == "virtual"
|
- system_cfg.type == "virtual"
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
block:
|
block:
|
||||||
- name: Query Proxmox for existing VM
|
- name: Query Proxmox for existing VM
|
||||||
community.proxmox.proxmox_vm_info:
|
community.proxmox.proxmox_vm_info:
|
||||||
node: "{{ hypervisor_cfg.host }}"
|
node: "{{ hypervisor_cfg.node }}"
|
||||||
vmid: "{{ system_cfg.id }}"
|
vmid: "{{ system_cfg.id }}"
|
||||||
name: "{{ hostname }}"
|
name: "{{ hostname }}"
|
||||||
type: qemu
|
type: qemu
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{{ ns.out }}
|
{{ ns.out }}
|
||||||
community.vmware.vmware_guest:
|
community.vmware.vmware_guest:
|
||||||
cluster: "{{ hypervisor_cfg.cluster }}"
|
cluster: "{{ hypervisor_cfg.cluster if (hypervisor_cfg.node | default('') | length == 0) else omit }}"
|
||||||
|
esxi_hostname: "{{ hypervisor_cfg.node if (hypervisor_cfg.node | default('') | length > 0) else omit }}"
|
||||||
folder: "{{ system_cfg.path if system_cfg.path | string | length > 0 else omit }}"
|
folder: "{{ system_cfg.path if system_cfg.path | string | length > 0 else omit }}"
|
||||||
name: "{{ hostname }}"
|
name: "{{ hostname }}"
|
||||||
# Generic guest ID — VMware auto-detects OS post-install
|
# Generic guest ID — VMware auto-detects OS post-install
|
||||||
|
|||||||
Reference in New Issue
Block a user