feat(vmware): add hypervisor.node for ESXi host pinning (mutually exclusive with cluster)
This commit is contained in:
@@ -47,6 +47,7 @@ hypervisor_defaults:
|
|||||||
username: ""
|
username: ""
|
||||||
password: ""
|
password: ""
|
||||||
host: ""
|
host: ""
|
||||||
|
node: ""
|
||||||
storage: ""
|
storage: ""
|
||||||
datacenter: ""
|
datacenter: ""
|
||||||
cluster: ""
|
cluster: ""
|
||||||
@@ -139,7 +140,7 @@ hypervisor_required_fields:
|
|||||||
hypervisor: [url, username, password, host, storage]
|
hypervisor: [url, username, password, host, 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: []
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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