forked from vmware/ansible-vsphere-gos-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
53 lines (47 loc) · 1.77 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright 2021-2024 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
---
# Main playbook for launching guest OS validation testing on vSphere
- name: main
hosts: localhost
gather_facts: false
tasks:
- name: "Read variables from vars file"
ansible.builtin.include_vars:
file: "{{ testing_vars_file | default('vars/test.yml') }}"
- name: "Set facts of the current main playbook directory and cache directory"
ansible.builtin.set_fact:
main_playbook_path: "{{ playbook_dir }}"
local_cache: "{{ playbook_dir }}/cache"
- name: "Display the directory info"
ansible.builtin.debug:
msg:
- "Current main playbook directory: {{ main_playbook_path }}"
- "Local cache directory: {{ local_cache }}"
- include_tasks: common/create_directory.yml
vars:
dir_path: "{{ local_cache }}"
dir_mode: "0777"
- name: "Get test suite and cases number in total"
ansible.builtin.set_fact:
gosv_test_suite: >-
{{
testing_testcase_file |
default('linux/gosv_testcase_list.yml') |
dirname | basename
}}
gosv_testcases_count: >-
{{
lookup('file', testing_testcase_file |
default('linux/gosv_testcase_list.yml')) |
from_yaml | length
}}
- name: "Print test cases number in total"
ansible.builtin.debug:
msg: "There are {{ gosv_testcases_count }} {{ gosv_test_suite }} test cases to run in total."
# Prepare testing environment
- import_playbook: env_setup/env_setup.yml
# Execute test case one by one
- import_playbook: "{{ testing_testcase_file | default('linux/gosv_testcase_list.yml') }}"
# Cleanup testing environment
- import_playbook: env_setup/env_cleanup.yml