The bug with systemd-networkd's built-in dhcp client #54 isn't really a problem with OpenVZ, but with the ancient kernel. Using an old kernel on a KVM (e.g., tiny 64MB RAM, recent Debian kernel/initramfs is too big) presents the same problem.
So the decision of whether to use dhcpcd5 instead of systemd dhcp client should be based on parsing ansible_kernel rather than ansible_virtualization_type.
The bug with systemd-networkd's built-in dhcp client #54 isn't really a problem with OpenVZ, but with the ancient kernel. Using an old kernel on a KVM (e.g., tiny 64MB RAM, recent Debian kernel/initramfs is too big) presents the same problem.
So the decision of whether to use dhcpcd5 instead of systemd dhcp client should be based on parsing
ansible_kernel
rather thanansible_virtualization_type
.