Skip to content

Commit

Permalink
enhance 2 appliance targets
Browse files Browse the repository at this point in the history
  • Loading branch information
prabinovRedhat committed Dec 18, 2024
1 parent 07a9611 commit 114c0c3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: Get the VCSA version
vmware.vmware_rest.appliance_system_version_info:
register: version_result

- name: Debug VCSA Version
ansible.builtin.debug:
var: version_result

- name: Validate VCSA Version Info
ansible.builtin.assert:
that:
- version_result is defined and version_result is not none # Ensure version_result is returned
- version_result.value is defined and version_result.value is not none # Ensure value field exists
- "'build' in version_result.value" # Ensure 'build' key exists
- "'version' in version_result.value" # Ensure 'version' key exists
- "'product' in version_result.value" # Ensure 'product' key exists
- "'install_time' in version_result.value" # Ensure 'install_time' key exists
- "'summary' in version_result.value" # Ensure 'summary' key exists
- "'releasedate' in version_result.value" # Ensure 'releasedate' key exists
- version_result.value.version is regex('^\d+\.\d+\.\d+.*$') # Validate 'version' matches semantic versioning
- version_result.value.product == "VMware vCenter Server" # Ensure product is VMware vCenter Server
- version_result.value.type is defined and version_result.value.type == "vCenter Server with an embedded Platform Services Controller" # Check product type

- name: Check if the system is up to date
vmware.vmware_rest.appliance_update_info:
register: update_result

- name: Debug Update Info
ansible.builtin.debug:
var: update_result

- name: Validate Update Info
ansible.builtin.assert:
that:
- update_result is defined and update_result is not none # Ensure update_result is returned
- update_result.value is defined and update_result.value is not none # Ensure value field exists
- "'state' in update_result.value" # Ensure 'state' key exists
- update_result.value.state == 'UP_TO_DATE' # Ensure the system is fully up-to-date
fail_msg: "The system is not up-to-date. Current state: {{ update_result.value.state }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Get the current time
vmware.vmware_rest.appliance_system_time_info:
register: result

- name: Debug Output
ansible.builtin.debug:
var: result

- name: Validate Time Info
ansible.builtin.assert:
that:
- result is defined and result is not none # Ensure result is returned
- result.value is defined and result.value is not none # Ensure the value field is returned
- "'date' in result.value" # Ensure the 'date' key exists
- "'time' in result.value" # Ensure the 'time' key exists
- "'seconds_since_epoch' in result.value" # Ensure the 'seconds_since_epoch' key exists
- "'timezone' in result.value" # Ensure the 'timezone' key exists
- result.value.time is regex('^\d{2}:\d{2}:\d{2} [AP]M$') # Validate 'time' matches 12-hour clock format
- result.value.date is regex('^[A-Za-z]{3} \d{2}-\d{2}-\d{4}$') # Validate 'date' matches format "Wed 12-18-2024"
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- import_tasks: appliance_networking_proxy.yml
# - import_tasks: appliance_services.yml
# - import_tasks: appliance_shutdown.yml
# - import_tasks: appliance_system.yml
- import_tasks: appliance_system.yml
# - import_tasks: appliance_system_storage.yml
# - import_tasks: appliance_time.yml
- import_tasks: appliance_time.yml
# - import_tasks: appliance_vmon_service.yml

0 comments on commit 114c0c3

Please sign in to comment.