1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/vmware_host_ntp/tasks/main.yml

169 lines
4.9 KiB
YAML
Raw Normal View History

# 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