Skip to content

Commit

Permalink
Enhance appliance health target to run on vCenter env
Browse files Browse the repository at this point in the history
  • Loading branch information
prabinovRedhat committed Nov 6, 2024
1 parent 12d852e commit 359f3ec
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/integration/integration_config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
VMWARE_HOST: ${VCENTER_HOSTNAME}
VMWARE_USER: ${VCENTER_USERNAME}
VMWARE_PASSWORD: ${VCENTER_PASSWORD}
VMWARE_VALIDATE_CERTS=no
VMWARE_VALIDATE_CERTS: false
ansible_tags: eco-vcenter-ci
1 change: 0 additions & 1 deletion tests/integration/targets/appliance/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
- import_tasks: appliance_access_dcui.yml
- import_tasks: appliance_access_shell.yml
- import_tasks: appliance_access_ssh.yml
- import_tasks: appliance_health.yml
- import_tasks: appliance_infraprofile_configs.yml
- import_tasks: appliance_localaccounts.yml
- import_tasks: appliance_monitoring.yml
Expand Down
8 changes: 7 additions & 1 deletion tests/integration/targets/init-eco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ fi

echo "ANSIBLE_COLLECTIONS_PATH: $ANSIBLE_COLLECTIONS_PATH"
BASE_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
export ANSIBLE_ROLES_PATH=${BASE_DIR}
export ANSIBLE_ROLES_PATH=${BASE_DIR}

# Authentication vars
export VMWARE_HOST=$(awk '/VMWARE_HOST/ {print $2}' ../../integration_config.yml)
export VMWARE_USER=$(awk '/VMWARE_USER/ {print $2}' ../../integration_config.yml)
export VMWARE_PASSWORD=$(awk '/VMWARE_PASSWORD/ {print $2}' ../../integration_config.yml)
export VMWARE_VALIDATE_CERTS=$(awk '/VMWARE_VALIDATE_CERTS/ {print $2}' ../../integration_config.yml)
16 changes: 16 additions & 0 deletions tests/integration/targets/vmware_rest_appliance/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- 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 role
ansible.builtin.import_role:
name: vmware_rest_appliance
tags:
- eco-vcenter-ci

Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
- name: Get the database health status
vmware.vmware_rest.appliance_health_database_info:
register: db_health
ignore_errors: true

- name: Print db_health
ansible.builtin.debug:
var: db_health

- name: Get the database storage health status
vmware.vmware_rest.appliance_health_databasestorage_info:
register: db_storage_health

- name: Print db_storage_health
ansible.builtin.debug:
var: db_storage_health

- name: Assert database storage health status
ansible.builtin.assert:
that:
- db_storage_health.value == "green"
fail_msg: "Database storage health status is not green"

- name: Get the system load status
vmware.vmware_rest.appliance_health_load_info:
register: system_load_health

- name: Print system_load_health
ansible.builtin.debug:
var: system_load_health

- name: Assert system load health status
ansible.builtin.assert:
that:
- system_load_health.value == "green"
fail_msg: "System load status is not green"

- name: Get the system memory status
vmware.vmware_rest.appliance_health_mem_info:
register: system_mem_health

- name: Print system_mem_health
ansible.builtin.debug:
var: system_mem_health

- name: Assert system memory health status
ansible.builtin.assert:
that:
- system_mem_health.value == "green"
fail_msg: "System memory health status is not green"

- name: Get the system health status
vmware.vmware_rest.appliance_health_system_info:
register: system_health

- name: Print system_health
ansible.builtin.debug:
var: system_health

- name: Assert system health status
ansible.builtin.assert:
that:
- system_health.value == "green"
fail_msg: "System health status is not green"

- name: Get the health of the software package manager
vmware.vmware_rest.appliance_health_softwarepackages_info:
register: software_pkg_health

- name: Print software_pkg_health
ansible.builtin.debug:
var: software_pkg_health

- name: Assert software package manager health status
ansible.builtin.assert:
that:
- software_pkg_health.value == "green"
fail_msg: "Software package manager health status is not green"

- name: Get the health of the storage system
vmware.vmware_rest.appliance_health_storage_info:
register: storage_health

- name: Print storage_health
ansible.builtin.debug:
var: storage_health

- name: Assert storage health status
ansible.builtin.assert:
that:
- storage_health.value == "green"
fail_msg: "Storage health status is not green"

- name: Get the health of the swap
vmware.vmware_rest.appliance_health_swap_info:
register: swap_health

- name: Print swap_health
ansible.builtin.debug:
var: swap_health

- name: Assert swap health status
ansible.builtin.assert:
that:
- swap_health.value == "green"
fail_msg: "Swap health status is not green"

- name: Get the health state of applmgmt
vmware.vmware_rest.appliance_health_applmgmt_info:
register: applmgmt_health

- name: Print applmgmt_health
ansible.builtin.debug:
var: applmgmt_health

- name: Assert appliance management health status
ansible.builtin.assert:
that:
- applmgmt_health.value == "green"
fail_msg: "Appliance management health status is not green"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- import_tasks: appliance_health.yml

0 comments on commit 359f3ec

Please sign in to comment.