Resource Check¶
Teflo’s Resource Dependency Check Section is optional. It is run during the Validate task Resource_check is a dictionary which takes in three keys monitored_services (formerly was service), playbook, script
Monitored_Services¶
User can define a list of external components to check if their status is up or not. if all components are up the scenario will be executed .If one or more components are down the scenario will exit with an error. It will also indicate if a component name given is invalid.
The key “resource_check_endpoint” must be set in the teflo.cfg file to actually perform check. If not set this section is ignored. The “resource_check_endpoint” must be the URL of a “Cachet” status page endpoint. Component names must be valid for that status page
[defaults]
log_level=info
workspace=.
data_folder=.teflo
resource_check_endpoint=<URL>
Playbook/ Script¶
User can put in a list of customized playbooks or scripts to validate certain things before starting their scenario. if any of the user defined validation playbook/scripts fail the scenario will not be run.
All playbooks and scripts are run only on the localhost from where teflo is being executed. Teflo will not be able to take any output from these scripts/playbooks and make any decisions based on that Teflo will consider the resource _check successfull or not based on the return code received after running the playbook or script
Teflo uses the ansible to run these playbooks and scripts. User should define playbooks and scripts similar to how it is defined in the Execute section of Teflo
Example 1¶
Using service, playbook, script
---
name: Example Discriptor
description: Descriptor file with resource check section
resource_check:
monitored_services:
- polarion
- umb
playbook:
- name: ansible/list_block_devices.yml
ansible_options:
extra_vars:
X: 18
Y: 12
ch_dir: ./scripts/
- name: ansible/tests/test_execute_playbook.yml
ansible_options:
extra_vars:
X: 12
Y: 12
ch_dir: ../../scripts/
script:
- name: ./scripts/hello_world1.py Teflo_user
executable: python
- name: ./scripts/add_two_numbers.sh X=15 Y=15
provision:
.
.
.
orchestrate:
.
.
.
execute:
.
.
.
Example 2¶
Using service
name: Example Discriptor
description: Descriptor file with resource check section
resource_check:
monitored_services: ['polarion', 'umb']
provision:
.
.
.
orchestrate:
.
.
.