mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 12:51:25 -07:00
VMware: Allow user to set customization specification (#38530)
This fix adds new argument parameter which allows user to set customization specification which is already created with required values like Windows Product Key and Networking details etc. Fixes: #38404 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
6e6325503a
commit
d1cd6ee56d
1 changed files with 20 additions and 0 deletions
|
@ -262,6 +262,12 @@ options:
|
||||||
- ' - C(type) (string): Value type, string type by default.'
|
- ' - C(type) (string): Value type, string type by default.'
|
||||||
- ' - C(operation): C(remove): This attribute is required only when removing properties.'
|
- ' - C(operation): C(remove): This attribute is required only when removing properties.'
|
||||||
version_added: '2.6'
|
version_added: '2.6'
|
||||||
|
customization_spec:
|
||||||
|
description:
|
||||||
|
- Unique name identifying the requested customization specification.
|
||||||
|
- This parameter is case sensitive.
|
||||||
|
- If set, then overrides C(customization) parameter values.
|
||||||
|
version_added: '2.6'
|
||||||
extends_documentation_fragment: vmware.documentation
|
extends_documentation_fragment: vmware.documentation
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -1267,6 +1273,19 @@ class PyVmomiHelper(PyVmomi):
|
||||||
self.change_detected = True
|
self.change_detected = True
|
||||||
|
|
||||||
def customize_vm(self, vm_obj):
|
def customize_vm(self, vm_obj):
|
||||||
|
|
||||||
|
# User specified customization specification
|
||||||
|
custom_spec_name = self.params.get('customization_spec')
|
||||||
|
if custom_spec_name:
|
||||||
|
cc_mgr = self.content.customizationSpecManager
|
||||||
|
if cc_mgr.DoesCustomizationSpecExist(name=custom_spec_name):
|
||||||
|
temp_spec = cc_mgr.GetCustomizationSpec(name=custom_spec_name)
|
||||||
|
self.customspec = temp_spec.spec
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.module.fail_json(msg="Unable to find customization specification"
|
||||||
|
" '%s' in given configuration." % custom_spec_name)
|
||||||
|
|
||||||
# Network settings
|
# Network settings
|
||||||
adaptermaps = []
|
adaptermaps = []
|
||||||
for network in self.params['networks']:
|
for network in self.params['networks']:
|
||||||
|
@ -2095,6 +2114,7 @@ def main():
|
||||||
networks=dict(type='list', default=[]),
|
networks=dict(type='list', default=[]),
|
||||||
resource_pool=dict(type='str'),
|
resource_pool=dict(type='str'),
|
||||||
customization=dict(type='dict', default={}, no_log=True),
|
customization=dict(type='dict', default={}, no_log=True),
|
||||||
|
customization_spec=dict(type='str', default=None),
|
||||||
vapp_properties=dict(type='list', default=[]),
|
vapp_properties=dict(type='list', default=[]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue