diff --git a/changelogs/fragments/2293-deprecate-vmware_maintenancemode.yml b/changelogs/fragments/2293-deprecate-vmware_maintenancemode.yml new file mode 100644 index 0000000000..48af616cfd --- /dev/null +++ b/changelogs/fragments/2293-deprecate-vmware_maintenancemode.yml @@ -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). diff --git a/galaxy.yml b/galaxy.yml index 473bbdcf64..25eddc8472 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -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 diff --git a/meta/runtime.yml b/meta/runtime.yml index 5e9b1d726e..ce8295a6d8 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -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. diff --git a/plugins/modules/vmware_maintenancemode.py b/plugins/modules/vmware_maintenancemode.py index faeda3a312..3acd9bfa4a 100644 --- a/plugins/modules/vmware_maintenancemode.py +++ b/plugins/modules/vmware_maintenancemode.py @@ -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. diff --git a/tests/integration/targets/prepare_vmware_tests/tasks/move_host_out_of_cluster.yml b/tests/integration/targets/prepare_vmware_tests/tasks/move_host_out_of_cluster.yml index d4a68d642e..e82f0d2883 100644 --- a/tests/integration/targets/prepare_vmware_tests/tasks/move_host_out_of_cluster.yml +++ b/tests/integration/targets/prepare_vmware_tests/tasks/move_host_out_of_cluster.yml @@ -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 @@ -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 diff --git a/tests/integration/targets/prepare_vmware_tests/tasks/setup_attach_hosts.yml b/tests/integration/targets/prepare_vmware_tests/tasks/setup_attach_hosts.yml index 38c8adf3cf..5316f27860 100644 --- a/tests/integration/targets/prepare_vmware_tests/tasks/setup_attach_hosts.yml +++ b/tests/integration/targets/prepare_vmware_tests/tasks/setup_attach_hosts.yml @@ -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, diff --git a/tests/integration/targets/vmware_host_auto_start/tasks/main.yml b/tests/integration/targets/vmware_host_auto_start/tasks/main.yml index c3028864ef..c1850ffea2 100644 --- a/tests/integration/targets/vmware_host_auto_start/tasks/main.yml +++ b/tests/integration/targets/vmware_host_auto_start/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/vmware_maintenancemode/aliases b/tests/integration/targets/vmware_maintenancemode/aliases deleted file mode 100644 index 07e8732a30..0000000000 --- a/tests/integration/targets/vmware_maintenancemode/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/vcenter -needs/target/prepare_vmware_tests -zuul/vmware/vcenter_1esxi diff --git a/tests/integration/targets/vmware_maintenancemode/tasks/main.yml b/tests/integration/targets/vmware_maintenancemode/tasks/main.yml deleted file mode 100644 index 2acdb90ee3..0000000000 --- a/tests/integration/targets/vmware_maintenancemode/tasks/main.yml +++ /dev/null @@ -1,76 +0,0 @@ -# Test code for the vmware_guest_maintenancemode module. -# Copyright: (c) 2017, Abhijeet Kasurde -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -- import_role: - name: prepare_vmware_tests - vars: - setup_attach_host: true - - -- name: Enter maintenance mode - vmware_maintenancemode: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - state: present - esxi_hostname: '{{ esxi1 }}' - validate_certs: false - register: test_result_0001 - -- debug: var=test_result_0001 - -- name: assert that changes were made - assert: - that: - - test_result_0001 is changed - -- name: Enter maintenance mode again - vmware_maintenancemode: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - state: present - esxi_hostname: '{{ esxi1 }}' - validate_certs: false - register: test_result_0002 - -- debug: var=test_result_0002 - -- name: assert that no changes were made - assert: - that: - - not (test_result_0002 is changed) - -- name: Exit maintenance mode - vmware_maintenancemode: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - state: absent - esxi_hostname: '{{ esxi1 }}' - validate_certs: false - register: test_result_0003 - -- debug: var=test_result_0003 - -- name: assert that changes were made - assert: - that: - - test_result_0003 is changed - -- name: Exit maintenance mode again - vmware_maintenancemode: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - state: absent - esxi_hostname: '{{ esxi1 }}' - validate_certs: false - register: test_result_0004 - -- debug: var=test_result_0004 - -- name: assert that no changes were made - assert: - that: - - not (test_result_0004 is changed) diff --git a/tests/integration/targets/vmware_resource_pool/tasks/main.yml b/tests/integration/targets/vmware_resource_pool/tasks/main.yml index 2d34680f28..152dfd02b8 100644 --- a/tests/integration/targets/vmware_resource_pool/tasks/main.yml +++ b/tests/integration/targets/vmware_resource_pool/tasks/main.yml @@ -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: @@ -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: diff --git a/tests/integration/targets/vmware_vmotion/tasks/main.yml b/tests/integration/targets/vmware_vmotion/tasks/main.yml index 5f33a51afd..71b8b3ae6c 100644 --- a/tests/integration/targets/vmware_vmotion/tasks/main.yml +++ b/tests/integration/targets/vmware_vmotion/tasks/main.yml @@ -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 @@ -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