Skip to content
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

[WIP] vcenter_object_move: add module to move vCenter inventory object #2346

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbaerlocher
Copy link

@sbaerlocher sbaerlocher commented Mar 6, 2025

SUMMARY

This commit introduces the new module vcenter_object_move which allows moving vCenter inventory objects (e.g., Virtual Machines, Hosts, Datastores, Networks) into a specified destination folder. The module ensures idempotence by checking if the object is already located in the target folder and supports Ansible check mode for dry-run operations. This feature simplifies inventory management in vCenter environments and aids in maintaining an organized structure.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

vcenter_object_move

ADDITIONAL INFORMATION

The module leverages pyVmomi to interact with the vCenter API and integrates with the existing utilities from the community.vmware collection. It performs the following steps:

  1. Validates input parameters (datacenter, object_name, object_type, destination_folder).
  2. Locates the vCenter datacenter and the specified inventory object.
  3. Traverses the folder structure to locate the destination folder.
  4. Moves the object if it is not already in the target folder; if it is, no action is taken.
  5. Supports check mode to simulate the move without applying changes.

Example command output:

{
    "changed": true,
    "msg": "Object 'MyVM' was successfully moved to folder 'NewFolder/SubFolder'."
}

@sbaerlocher sbaerlocher changed the title [WIP] vcenter_object_move: add module to move vCenter inventory objec… [WIP] vcenter_object_move: add module to move vCenter inventory object Mar 6, 2025
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from fa0413d to 684b5a3 Compare March 6, 2025 12:52
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from 684b5a3 to c6ed128 Compare March 6, 2025 13:28
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from c6ed128 to b286376 Compare March 6, 2025 14:04
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from b286376 to 9093b90 Compare March 6, 2025 14:40
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from 9093b90 to ced45ff Compare March 6, 2025 15:26
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from ced45ff to d0aa895 Compare March 6, 2025 16:27
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from d0aa895 to e85aea0 Compare March 6, 2025 17:35
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from e85aea0 to bba9879 Compare March 6, 2025 18:21
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from bba9879 to 7bababd Compare March 6, 2025 18:53
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from 7bababd to 6ad7b63 Compare March 6, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant