Skip to content

Commit

Permalink
modify appliance-multi-hosts to work on eco vsphere
Browse files Browse the repository at this point in the history
  • Loading branch information
shellymiron committed Dec 8, 2024
1 parent 4e0b5fa commit 9ed0ffa
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- hosts: localhost
gather_facts: no

tasks:
- name: Import eco-vcenter credentials
ansible.builtin.include_vars:
file: ../../integration_config.yml
tags: eco-vcenter-ci

- name: Import appliance multi-hosts role
ansible.builtin.import_role:
name: vmware_rest_appliance-multi-hosts
tags:
- eco-vcenter-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
- name: Manage NTP Configuration on vCenter
block:
- name: Reset the NTP configuration
vmware.vmware_rest.appliance_ntp:
servers:
- ca.pool.ntp.org
delegate_to: localhost

- name: Retrieve the initial NTP configuration
vmware.vmware_rest.appliance_ntp_info:
delegate_to: localhost

- name: Set the NTP configuration to use google NTP servers
vmware.vmware_rest.appliance_ntp:
servers:
- time.google.com
delegate_to: localhost

- name: Verify idempotency of NTP configuration
vmware.vmware_rest.appliance_ntp:
servers:
- time.google.com
delegate_to: localhost
register: ntp_result

- name: Debug idempotency result
ansible.builtin.debug:
var: ntp_result

- name: Assert idempotency
ansible.builtin.assert:
that:
- not (ntp_result.changed)

- name: Retrieve the updated NTP configuration
vmware.vmware_rest.appliance_ntp_info:
delegate_to: localhost
register: ntp_info

- name: Debug updated NTP configuration
ansible.builtin.debug:
var: ntp_info

- name: Assert the NTP configuration matches expected servers
ansible.builtin.assert:
that:
- ntp_info.value == ["time.google.com"]

- name: Test the NTP configuration connectivity
vmware.vmware_rest.appliance_ntp:
state: test
servers:
- time.google.com
delegate_to: localhost
register: ntp_test_result

- name: Debug NTP test result
ansible.builtin.debug:
var: ntp_test_result

- name: Ensure the NTP server is reachable
ansible.builtin.assert:
that:
- ntp_test_result.value[0].status == "SERVER_REACHABLE"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- import_tasks: appliance_ntp.yml

0 comments on commit 9ed0ffa

Please sign in to comment.