-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux deployment from template by Ansible not working. Network in disconnected state. #1991
Comments
Can you try installing vmtools or open-vm-tools on the template. |
Do you use distributed vSwitches and normal vSwitches parallel? I noticed problems when there are portgroups with the same name on different switches. |
Hello, I encounter the same problem. My VM is a Rocky Linux and I already have the VMtools pre-installed in my template. I tried with and without the options, I don't have the issue with Windows template. All of my VMs are using the same vSwitch which is a 'distributed vSwitch' I use the version 4.1.0 of the collection and ansible-core 2.16.3 Thank you for your support. |
Hi @mariolenz , May I request your help please ? Thank you! |
@FireHelmet Try some simple experiments to determine the scope of the problem:
If the VM was created from a template and connected to the network, the problem is probably not in the template and, PROBABLY, not in module. To exclude (or confirmation of the problem) the module, it may make sense to create a separate portgroup in your VDS for further testing. |
Hello @ihumster , Thank you for your quick answer. I tested what you proposed by doing,
Please find my playbook I used for the deployment and the result below,
Thank you for your support, |
@FireHelmet Hmm. Why Checkbox |
I don't know why this checkbox is disabled on the Linux VM, also I don't have the issue with Windows deployment. No, the VM used as template has the checkbox enabled (I reconverted the template as a VM to show you this setting because this kind of setting can't be changed or looked when the VM is converted as a template), |
I found similar issue on vmware forums. Look take on this commentary https://communities.vmware.com/t5/vCenter-Server-Discussions/deployed-VM-from-template-but-NIC-is-disconnected/m-p/2977937/highlight/true#M94606 |
Thanks @ihumster , I tried to add Also I'm not using any customization template. I did a last test by doing a deployment of my template from the vCenter, so by hand...and the checkbox is well enabled so I'm thinking the problem comes from the ansible collection OR pyvmomi See capture of the deployment by hand of FROT997 below, What's your opinion ? Many thanks for your support |
@FireHelmet Need to check something else: you can try add no
|
Still disconnected, The playbook I used,
|
Hello @FireHelmet, can you check if there are events like "customization started" at the deployed vm. (In the UI > Monitor > events). And as last test can just test this:
(remove connected, start_connected, allow_guest_control, when those settings are set it seems like the module does this:
Maybe that ist related to this issue? Regards |
Hello @MaximilianClemens , Yes, please see below on a newly created VM from same template and same setting except the name, Also, no cloud-init log because I don't use customization feature from vSphere, About the test of What's an "opaque network" ? Thank you for your support too. |
Is there anything under Events in the vsphere ui? I don't know what a opaque network is, but my theory was, that something triggers a customization, even when not wanted and this customization fails. that failure would result in a disconnected adapter. |
No, nothing related to "customization" and as I wrote, the issue doesn't appear when I deploy the VM from the same template but manually from the vCenter UI. Also, no issues with Windows templates. Currently I used a workaround by using a powershell script with PowerCLI running on a Windows host and this ansible playbook
I use Rundeck on top of Ansible it's the reason why the variables have this format ${option.xxx} |
@MaximilianClemens FYI |
@FireHelmet I guess we'll have to dive into some deep debugging. Please deploy a new VM from this template and send here the machine log - |
Where did you add this? So I can try it. |
Hello @ihumster , Please find the log here https://pastebin.com/w13XP186 . The retention is 1 month. Thank you very much for your support |
Hello @FilipFabicevic , I added the key/value in the .vmx of the VM. But as I said this fix doesn't work and not only for me. |
@FireHelmet I looked at the log and didn't see anything interesting about the problem. Perhaps you need to do some more research and look at a piece of For convenience, you can “kick out” all the VMs from one of the hosts (switch DRS to Manual mode) and try to launch the playbook (indicating the deployment of the VM not to the cluster, but to this host) and look at hostd.log at the same time. |
Please find the hostd.log here https://pastebin.com/6qPL78hE . The retention is 1 month. I just extracted all logs around the VM ID and/or the name of the VM. I hope this log will help you. Thank you very much for your support |
@FireHelmet And add vmkernel.log for same time from host. |
Please find the vmkernel.log here https://pastebin.com/WDYYsBuQ. The retention is 1 month. I just extracted all logs around the VM ID and/or the name of the VM. I hope this log will help you. Thank you very much for your support |
@FireHelmet Either the logs are not complete, or there is nothing in them about the VM’s network adapter. You extract logs around VM ID/Name, but need more logs about |
I have same network names on standard switch and dswitch. So when I want to change adapter
Task fails. I do put dvswitch_name to my switches name, but I'm not sure if he really selects network from dvswitch, but it takes one from standard switch vsphere 7.0.3 U3 |
Hey @djvujke , Please open a new issue because it's not the same topic. Thanks |
Hello, Just came here to say we encounter the same issue since we migrated to vSphere 8.0.2 (build 23319993) from vSphere 7.
We are currently testing to integrate to the template the following conf:
I will keep you updated. Regards, |
FYI I had some apparently similar issues. I made a hacky workaround by changing the network interfaces to start disconnected when provisioning, and connecting them after the VM was created. This seemed to work nicely, and might work for you as well. In the end it turned out that my issue was caused by the VM template not having Netplan installed, and VMware expecting it to be available and failing customization because of this. The symptoms were similar enough that I thought I had the same issue as y'all 😅 |
Hi,
I have been trying to deploy the linux VM from the below playbook via template and it's deploying fine however it's not connecting to the network, and it stays in the disconnected state.
On the VM I see this: - "A start job is running for wait for Network to be configured" and after some time it timed out.
As part of troubleshooting, we tried below but nothing worked. Any suggestion to fix this?
community.vmware.vmware_guest:
hostname: "{{ vcenter_ip }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ vcenter_datacenter }}"
validate_certs: false
state: poweredon
folder:
template: "{{ vm_templet }}"
name: "{{ vm_name }}"
cluster: "{{ vcenter_cluster }}"
networks:
- name:
start_connected: True
connected: True
device_type: vmxnet3
ip:
netmask:
gateway:
type: static
dns_servers:
wait_for_ip_address: true
customization:
hostname:
dns_servers:
-
-
dns_suffix:
-
timezone: 165
script_text: |
#!/bin/bash
touch /tmp/touch-from-playbook
delegate_to: localhost
The text was updated successfully, but these errors were encountered: