Skip to content

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
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from 6ad7b63 to 753186a Compare November 15, 2025 21:58
@softwarefactory-project-zuul
Copy link

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/8225b0f3c463459c923b7618bd6abed7

ansible-tox-linters FAILURE in 5m 00s
⚠️ ansible-galaxy-importer CANCELED (non-voting)
⚠️ build-ansible-collection CANCELED

Warning:
Job ansible-tox-linters: unable to map line for file comments:
stderr: 'fatal: -L invalid line number: 0'

@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from 753186a to ce0962c Compare November 15, 2025 22:08
@softwarefactory-project-zuul
Copy link

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/b8e4bca501834299807fba2b2de58c02

✔️ ansible-tox-linters SUCCESS in 5m 04s
✔️ ansible-galaxy-importer SUCCESS in 4m 11s (non-voting)
✔️ build-ansible-collection SUCCESS in 6m 59s

@sbaerlocher sbaerlocher changed the title [WIP] vcenter_object_move: add module to move vCenter inventory object vcenter_object_move: add module to move vCenter inventory object Nov 15, 2025
- Replace deprecated ansible.module_utils._text import with
  ansible.module_utils.common.text.converters
- Use base_argument_spec from vmware.vmware collection
- Update documentation fragment to vmware.vmware.base_options
- Add changelog fragment for new vcenter_object_move module
@sbaerlocher sbaerlocher force-pushed the feature/add-vcenter-object-move branch from ce0962c to 7f735bf Compare November 16, 2025 22:13
@softwarefactory-project-zuul
Copy link

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/647f42f04fc2410cafb9556fc19bc7f6

✔️ ansible-tox-linters SUCCESS in 5m 36s
✔️ ansible-galaxy-importer SUCCESS in 4m 10s (non-voting)
✔️ build-ansible-collection SUCCESS in 6m 42s

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