Skip to content

Commit

Permalink
Deprecate vmware_maintenancemode (#2293)
Browse files Browse the repository at this point in the history
SUMMARY
Deprecate community.vmware.vmware_maintenancemode in favor of vmware.vmware.esxi_maintenance_mode.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
vmware_maintenancemode
ADDITIONAL INFORMATION
ansible-collections/vmware.vmware#99
  • Loading branch information
mariolenz authored Jan 25, 2025
1 parent 078cedd commit af13893
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 104 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deprecated_features:
- vmware_maintenancemode - the module has been deprecated and will be removed in community.vmware 7.0.0
(https://github.com/ansible-collections/community.vmware/pull/2293).
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tags:
- vmware
- virtualization
dependencies:
vmware.vmware: ">=1.5.0,<2.0.0"
vmware.vmware: ">=1.9.0,<2.0.0"
repository: https://github.com/ansible-collections/community.vmware.git
homepage: https://github.com/ansible-collections/community.vmware
issues: https://github.com/ansible-collections/community.vmware/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
4 changes: 4 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,7 @@ plugin_routing:
deprecation:
removal_version: 6.0.0
warning_text: Use vmware.vmware.cluster_vcls instead.
vmware_maintenancemode:
deprecation:
removal_version: 7.0.0
warning_text: Use vmware.vmware.esxi_maintenance_mode instead.
4 changes: 4 additions & 0 deletions plugins/modules/vmware_maintenancemode.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
DOCUMENTATION = r'''
---
module: vmware_maintenancemode
deprecated:
removed_in: 7.0.0
why: This module has been moved to the L(new vmware.vmware collection,https://forum.ansible.com/t/5880)
alternative: Use M(vmware.vmware.esxi_maintenance_mode) instead.
short_description: Place a host into maintenance mode
description:
- This module can be used for placing a ESXi host into maintenance mode.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: Enter maintenance mode
vmware_maintenancemode:
vmware.vmware.esxi_maintenance_mode:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ item }}"
state: present
esxi_host_name: "{{ item }}"
enable_maintenance_mode: true
with_items: "{{ esxi_hosts }}"
ignore_errors: true

Expand All @@ -24,12 +24,12 @@
ignore_errors: true

- name: Exit maintenance mode
vmware_maintenancemode:
vmware.vmware.esxi_maintenance_mode:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ item }}"
state: absent
esxi_host_name: "{{ item }}"
enable_maintenance_mode: false
with_items: "{{ esxi_hosts }}"
ignore_errors: true
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
with_items: "{{ esxi_hosts }}"

- name: Disable the Maintenance Mode
vmware_maintenancemode:
esxi_hostname: '{{ item }}'
state: absent
vmware.vmware.esxi_maintenance_mode:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_host_name: '{{ item }}'
enable_maintenance_mode: false
with_items: "{{ esxi_hosts }}"

# A bit of explanation here. Our test VMs will produce some ARP traffic,
Expand Down
10 changes: 7 additions & 3 deletions tests/integration/targets/vmware_host_auto_start/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
with_items: "{{ esxi_hosts }}"

- name: Disable the Maintenance Mode
vmware_maintenancemode:
esxi_hostname: '{{ item }}'
state: absent
vmware.vmware.esxi_maintenance_mode:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_host_name: '{{ item }}'
enable_maintenance_mode: false
with_items: "{{ esxi_hosts }}"

- name: Create VM on esxi1
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/targets/vmware_maintenancemode/aliases

This file was deleted.

76 changes: 0 additions & 76 deletions tests/integration/targets/vmware_maintenancemode/tasks/main.yml

This file was deleted.

12 changes: 6 additions & 6 deletions tests/integration/targets/vmware_resource_pool/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@
block:
# Remove ESXi host from cluster for tests
- name: Enter maintenance mode
vmware_maintenancemode:
vmware.vmware.esxi_maintenance_mode:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ esxi2 }}"
state: present
esxi_host_name: "{{ esxi2 }}"
enable_maintenance_mode: true

- name: Move ESXi out of Cluster
vmware_host:
Expand All @@ -251,13 +251,13 @@
state: reconnect

- name: Exit maintenance mode
vmware_maintenancemode:
vmware.vmware.esxi_maintenance_mode:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ esxi2 }}"
state: absent
esxi_host_name: "{{ esxi2 }}"
enable_maintenance_mode: false

- name: add resource pool to ESXi with check_mode
vmware_resource_pool:
Expand Down
20 changes: 14 additions & 6 deletions tests/integration/targets/vmware_vmotion/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
with_items: '{{ esxi_hosts }}'

- name: Disable the Maintenance Mode
vmware_maintenancemode:
esxi_hostname: '{{ item }}'
state: absent
vmware.vmware.esxi_maintenance_mode:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: false
esxi_host_name: '{{ item }}'
enable_maintenance_mode: false
with_items: '{{ esxi_hosts }}'

- name: Create VM
Expand Down Expand Up @@ -91,9 +95,13 @@
with_items: '{{ esxi_hosts }}'

- name: Disable the Maintenance Mode
vmware_maintenancemode:
esxi_hostname: '{{ item }}'
state: absent
vmware.vmware.esxi_maintenance_mode:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: false
esxi_host_name: '{{ item }}'
enable_maintenance_mode: false
with_items: '{{ esxi_hosts }}'

- name: Perform vMotion of virtual machine to resource_pool
Expand Down

0 comments on commit af13893

Please sign in to comment.