ansible/test/integration/targets/vmware_host_service_manager/tasks/main.yml
pratikgadiya12 8ee7d9f598 VMWare - Rename _facts to _info (#57474)
Deprecate vmware's _facts modules and add new modules.

Fixes: #57278
2019-08-26 14:45:34 -04:00

86 lines
2.9 KiB
YAML

# Test code for the vmware_host_service_manager module.
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# TODO: vcsim does not support service management
# commenting this testcase till the time.
- when: vcsim is not defined
block:
- import_role:
name: prepare_vmware_tests
vars:
setup_attach_host: true
- name: Start ntpd service on all hosts in given cluster
vmware_host_service_manager:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
cluster_name: "{{ ccr1 }}"
service_name: ntpd
state: present
register: all_hosts_result
- debug: var=all_hosts_result
- name: Stop ntpd service on a given host
vmware_host_service_manager:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
esxi_hostname: '{{ esxi1 }}'
service_name: ntpd
state: absent
register: single_hosts_result
- name: ensure info are gathered
assert:
that:
- single_hosts_result is changed
- name: Start ntpd service on all hosts in given cluster in check mode
vmware_host_service_manager:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
cluster_name: "{{ ccr1 }}"
service_name: ntpd
state: present
register: all_hosts_result_check_mode
check_mode: yes
- name: ensure info are gathered for all hosts
assert:
that:
- all_hosts_result_check_mode is changed
- name: Stop ntpd service on a given host in check mode
vmware_host_service_manager:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
esxi_hostname: '{{ esxi1 }}'
service_name: ntpd
state: absent
register: single_hosts_result_check_mode
check_mode: yes
- name: ensure info are gathered
assert:
that:
- not (single_hosts_result_check_mode is changed)
- name: Start ntpd service on all hosts in given cluster
vmware_host_service_manager:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
cluster_name: "{{ ccr1 }}"
service_name: ntpd
state: present
register: all_hosts_result_check_mode
- name: finally, ensure ntp is running on the cluster
assert:
that:
- all_hosts_result_check_mode is changed