4b99a2ac50
The use of the `hostvars[esxi1].ansible_host` was attempt to use different hostname and IP address. But it's actually the source of more problems. VMware expects to be able to resolvable the host name. This means, that if someone wants to run the test-suite, s/he needs to use a DNS or update the `/etc/hosts` files on the different hosts.
168 lines
4.9 KiB
YAML
168 lines
4.9 KiB
YAML
# Test code for the vmware_host_ntp 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 update host NTP configuration
|
|
- when: vcsim is not defined
|
|
block:
|
|
- import_role:
|
|
name: prepare_vmware_tests
|
|
vars:
|
|
setup_attach_host: true
|
|
|
|
- name: Add NTP server to a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: present
|
|
ntp_servers:
|
|
- 0.pool.ntp.org
|
|
validate_certs: no
|
|
register: present
|
|
- debug: var=present
|
|
|
|
- name: Add another NTP server to a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: present
|
|
ntp_servers:
|
|
- 1.pool.ntp.org
|
|
validate_certs: no
|
|
register: present
|
|
- debug: var=present
|
|
|
|
- name: Remove NTP server from a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: absent
|
|
ntp_servers:
|
|
- 1.pool.ntp.org
|
|
validate_certs: no
|
|
register: absent_one
|
|
- debug: var=absent_one
|
|
|
|
- name: Remove NTP server from a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: present
|
|
ntp_servers:
|
|
- 1.pool.ntp.org
|
|
validate_certs: no
|
|
register: present
|
|
- debug: var=present
|
|
|
|
- name: Add more NTP servers to a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: present
|
|
ntp_servers:
|
|
- 2.pool.ntp.org
|
|
- 3.pool.ntp.org
|
|
- 4.pool.ntp.org
|
|
validate_certs: no
|
|
register: present
|
|
- debug: var=present
|
|
|
|
- name: Remove all NTP servers from a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: absent
|
|
ntp_servers:
|
|
- 0.pool.ntp.org
|
|
- 1.pool.ntp.org
|
|
- 2.pool.ntp.org
|
|
- 3.pool.ntp.org
|
|
- 4.pool.ntp.org
|
|
- 6.pool.ntp.org
|
|
validate_certs: no
|
|
register: absent_all
|
|
- debug: var=absent_all
|
|
|
|
- name: Configure NTP servers for a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
ntp_servers:
|
|
- 0.pool.ntp.org
|
|
- 1.pool.ntp.org
|
|
- 2.pool.ntp.org
|
|
validate_certs: no
|
|
register: ntp_servers
|
|
- debug: var=ntp_servers
|
|
|
|
- name: Configure NTP servers for a host
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
ntp_servers:
|
|
- 3.pool.ntp.org
|
|
- 4.pool.ntp.org
|
|
- 5.pool.ntp.org
|
|
verbose: true
|
|
validate_certs: no
|
|
register: ntp_servers
|
|
- debug: var=ntp_servers
|
|
|
|
- name: Add NTP server to a host in check mode
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: present
|
|
ntp_servers:
|
|
- 0.pool.ntp.org
|
|
validate_certs: no
|
|
register: present
|
|
check_mode: yes
|
|
- debug: var=present
|
|
|
|
- name: Remove NTP server to a host in check mode
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
state: absent
|
|
ntp_servers:
|
|
- 0.pool.ntp.org
|
|
validate_certs: no
|
|
register: present
|
|
check_mode: yes
|
|
- debug: var=present
|
|
|
|
- name: Configure NTP servers for a host in check mode
|
|
vmware_host_ntp:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
esxi_hostname: '{{ esxi1 }}'
|
|
ntp_servers:
|
|
- 0.pool.ntp.org
|
|
- 1.pool.ntp.org
|
|
- 2.pool.ntp.org
|
|
validate_certs: no
|
|
register: ntp_servers
|
|
check_mode: yes
|
|
- debug: var=ntp_servers
|