name: vsphere-hostname.service
enabled: true
contents: |
  [Unit]
  Description=vSphere hostname
  Requires=vmtoolsd.service
  After=vmtoolsd.service

  ConditionPathExists=!/etc/hostname
  ConditionVirtualization=vmware
  
  Before=kubelet.service
  Before=node-valid-hostname.service
  Before=NetworkManager.service

  [Service]
  ExecStart=/usr/local/bin/vsphere-hostname.sh
  Restart=on-failure
  RestartSec=15

  [Install]
  WantedBy=multi-user.target

