Skip to content

esxi/object-rename

Defines any additional command line options to pass to ansible for playbooks

This data structure defines a vSphere object that should be renamed. An example task that uses it is the esxi-object-rename, which utilizes the Ansible Galaxy VMware modules and the playbook named vmware_rename_object.

The top-level object is a reference name to group rename operations together. This allows the operator to specify more than a single rename operation using the single Param data structure.

Requires the vCenter or ESXi authentication information is passed in via the govc/* Param values.

The following values are required:

  • new_name - the new name of the renamed object
  • object_type - the new name of the renamed object

In addition, only one of the following may be specified:

  • object_name - the object name in the inventory (mutually exclussive with object_moid)
  • object_moid - the *managed object identifier* (mutually exclussive withobject_name``)

For the object_type, only the following values are valid:

  • Cluster
  • ClusterComputeResource
  • Datacenter
  • Datastore
  • Folder
  • ResourcePool
  • VM or VirtualMachine

Example in YAML:

esxi/object-rename:
  vsan-datastore:
    new_name: "vsan-cluster01-datastore"
    object_name: "vsanDataStore"
    object_type: "Datastore"
  vm-generic:
    new_name: "Fedora_31"
    object_name: "Fedora_VM"
    object_type: "VirtualMachine"

Example in JSON:

"vsan-datastore": {
  "new_name": "vsan-cluster01-datastore",
  "object_name": "vsanDataStore",
  "object_type": "Datastore"
}
"vm-generic": {
  "new_name": "fedora-vm01",
  "object_name": "Fedora_VM",
  "object_type": "VirtualMachine"
}

In the above example, the VSAN Datastore named vsanDataStore should be renamed to vsan-cluster01-datastore. Subsequently, the Virtual Machine named Fedora_VM will be renamed to fedora-vm01.

Note

If a Golang Templating construct is desired for the new_name value, set the esxi/object-rename-override for the new_name value. In that case, this objects setting will be ignored.