ansible/test/integration/targets/vmware_maintenancemode/tasks/main.yml
Gonéri Le Bouder 39d1794ed9 vmware: refactoring of vmware test roles -- part6
Refactoring of the following roles to make use of the new
`prepare_vmware_tests` role.

- `vmware_inventory`
- `vmware_local_role_facts`
- `vmware_local_role_manager`
- `vmware_local_user_facts`
- `vmware_local_user_manager`
- `vmware_maintenancemode`
- `vmware_portgroup_facts`
- `vmware_resource_pool`
- `vmware_resource_pool_facts`

This patch depends on: https://github.com/ansible/ansible/pull/55719

Original PR: https://github.com/ansible/ansible/pull/54882
2019-05-02 09:28:01 -04:00

76 lines
2 KiB
YAML

# Test code for the vmware_guest_maintenancemode module.
# Copyright: (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
# 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: '{{ hostvars[esxi2].ansible_host }}'
validate_certs: no
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: '{{ hostvars[esxi2].ansible_host }}'
validate_certs: no
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: '{{ hostvars[esxi2].ansible_host }}'
validate_certs: no
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: '{{ hostvars[esxi2].ansible_host }}'
validate_certs: no
register: test_result_0004
- debug: var=test_result_0004
- name: assert that no changes were made
assert:
that:
- not (test_result_0004 is changed)