mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.9 KiB
YAML
87 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 facts 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 facts 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 facts 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
|