VMware: dns_suffix as a list of domain suffixes (#42678)
This fix adds dns_suffix as a list of domain suffixes and also updates documentation and example. Fixes: #42229 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
4af16d0c76
commit
db9c9e7fc5
1 changed files with 32 additions and 2 deletions
|
@ -395,7 +395,7 @@ EXAMPLES = r'''
|
|||
delegate_to: localhost
|
||||
register: deploy
|
||||
|
||||
- name: Clone a virtual machine from Template and customize
|
||||
- name: Clone a virtual machine from Windows template and customize
|
||||
vmware_guest:
|
||||
hostname: "{{ vcenter_ip }}"
|
||||
username: "{{ vcenter_username }}"
|
||||
|
@ -428,6 +428,32 @@ EXAMPLES = r'''
|
|||
- powershell.exe -ExecutionPolicy Unrestricted -File C:\Windows\Temp\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert -EnableCredSSP
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Clone a virtual machine from Linux template and customize
|
||||
vmware_guest:
|
||||
hostname: "{{ vcenter_server }}"
|
||||
username: "{{ vcenter_user }}"
|
||||
password: "{{ vcenter_password }}"
|
||||
validate_certs: no
|
||||
datacenter: "{{ datacenter }}"
|
||||
state: present
|
||||
folder: /DC1/vm
|
||||
template: "{{ template }}"
|
||||
name: "{{ vm_name }}"
|
||||
cluster: DC1_C1
|
||||
networks:
|
||||
- name: VM Network
|
||||
ip: 192.168.10.11
|
||||
netmask: 255.255.255.0
|
||||
wait_for_ip_address: True
|
||||
customization:
|
||||
domain: "{{ guest_domain }}"
|
||||
dns_servers:
|
||||
- 8.9.9.9
|
||||
- 7.8.8.9
|
||||
dns_suffix:
|
||||
- example.com
|
||||
- example2.com
|
||||
|
||||
- name: Rename a virtual machine (requires the virtual machine's uuid)
|
||||
vmware_guest:
|
||||
hostname: "{{ vcenter_ip }}"
|
||||
|
@ -1420,7 +1446,11 @@ class PyVmomiHelper(PyVmomi):
|
|||
|
||||
# TODO: Maybe list the different domains from the interfaces here by default ?
|
||||
if 'dns_suffix' in self.params['customization']:
|
||||
globalip.dnsSuffixList = self.params['customization']['dns_suffix']
|
||||
dns_suffix = self.params['customization']['dns_suffix']
|
||||
if isinstance(dns_suffix, list):
|
||||
globalip.dnsSuffixList = " ".join(dns_suffix)
|
||||
else:
|
||||
globalip.dnsSuffixList = dns_suffix
|
||||
elif 'domain' in self.params['customization']:
|
||||
globalip.dnsSuffixList = self.params['customization']['domain']
|
||||
|
||||
|
|
Loading…
Reference in a new issue