Trying to deploy a VM through ansible playbook. Deployment work fine. But I would like to configure IP address, netmask and gateway. Also I would like to add code for joining the vm to AD domain. Looked into guest_customization. But I am not finding any documentation on how to use guest_customization. There is some, but it only for Linux systems. Any tips/references will be appreciated.
Thanks
Yezdi
Best answer by JoseNutanix
That’s how Windows customization works, it’s not specific to Nutanix Ansible collection. Have a look to this sysprep file, in this case the variable parameters are for Terraform, but you can get an idea. Sysprep has builting AD join capability, you don’t have to do it at the FirstLogonCommand section.
From the ansible documentation by running ansible-doc nutanix.ncp.ntnx_vms.
- guest_customization
cloud_init or sysprep guest customization
"default": !!null"null""type": "dict"SUBOPTIONS:
- is_overridable
Flag to allow override of customization during deployment.
"default": !!bool "false""type": "bool"
= script_path
Absolute file path to the script.
"type": "path"
= type
cloud_init or sysprep type
choices: ["cloud_init", "sysprep"]
"type": "str"
Make sure to have your sysprep file prepared to provide it in the script_path. Any customization you want to make to the sysprep file will have to go through a template with jinja2
Thanks for taking time and responding to my question. I built an sysprepped image in Nutanix. Then also built an unattended.xml file with Windows SIM and ADK. I was able to deploy a VM with IP address successfully. Initially I was looking for some inline code in the playbook itself. But it seems it’s not possible.
For joining the node to AD domain, I used WMIC through FirstLogonCommands, but it attaches the VM to a workgroup, not domain. Also I need to specify username and passwd in the XML file which is not ideal. I was wondering what the best way to do this ?
That’s how Windows customization works, it’s not specific to Nutanix Ansible collection. Have a look to this sysprep file, in this case the variable parameters are for Terraform, but you can get an idea. Sysprep has builting AD join capability, you don’t have to do it at the FirstLogonCommand section.
Thanks again Jose. I tried to build a new unattended.xml file with “Microsoft-Windows-UnattendedJoin”. But it doesn’t seem to encrypt the passwd. It leaves it in clear text.