2017-10-01 11:12:11 +02:00
|
|
|
# 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)
|
2019-04-24 21:11:47 +02:00
|
|
|
- import_role:
|
|
|
|
name: prepare_vmware_tests
|
|
|
|
vars:
|
|
|
|
setup_attach_host: true
|
2017-10-01 11:12:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
- name: Enter maintenance mode
|
|
|
|
vmware_maintenancemode:
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-10-01 11:12:11 +02:00
|
|
|
state: present
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: '{{ esxi2 }}'
|
2017-10-01 11:12:11 +02:00
|
|
|
validate_certs: no
|
|
|
|
register: test_result_0001
|
|
|
|
|
|
|
|
- debug: var=test_result_0001
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
2019-04-24 21:11:47 +02:00
|
|
|
- test_result_0001 is changed
|
2017-10-01 11:12:11 +02:00
|
|
|
|
|
|
|
- name: Enter maintenance mode again
|
|
|
|
vmware_maintenancemode:
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-10-01 11:12:11 +02:00
|
|
|
state: present
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: '{{ esxi2 }}'
|
2017-10-01 11:12:11 +02:00
|
|
|
validate_certs: no
|
|
|
|
register: test_result_0002
|
|
|
|
|
|
|
|
- debug: var=test_result_0002
|
|
|
|
|
|
|
|
- name: assert that no changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
2019-04-24 21:11:47 +02:00
|
|
|
- not (test_result_0002 is changed)
|
2017-10-01 11:12:11 +02:00
|
|
|
|
|
|
|
- name: Exit maintenance mode
|
|
|
|
vmware_maintenancemode:
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-10-01 11:12:11 +02:00
|
|
|
state: absent
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: '{{ esxi2 }}'
|
2017-10-01 11:12:11 +02:00
|
|
|
validate_certs: no
|
|
|
|
register: test_result_0003
|
|
|
|
|
|
|
|
- debug: var=test_result_0003
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
2019-04-24 21:11:47 +02:00
|
|
|
- test_result_0003 is changed
|
2017-10-01 11:12:11 +02:00
|
|
|
|
|
|
|
- name: Exit maintenance mode again
|
|
|
|
vmware_maintenancemode:
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-10-01 11:12:11 +02:00
|
|
|
state: absent
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: '{{ esxi2 }}'
|
2017-10-01 11:12:11 +02:00
|
|
|
validate_certs: no
|
|
|
|
register: test_result_0004
|
|
|
|
|
|
|
|
- debug: var=test_result_0004
|
|
|
|
|
|
|
|
- name: assert that no changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
2019-04-24 21:11:47 +02:00
|
|
|
- not (test_result_0004 is changed)
|