Skip to content

Commit

Permalink
Remove "Read vars_file" for every playbook (#447)
Browse files Browse the repository at this point in the history
Signed-off-by: Winnie81 <wyue@vmware.com>
  • Loading branch information
Winnie81 committed Mar 30, 2023
1 parent 0e567ef commit b0db6c8
Show file tree
Hide file tree
Showing 69 changed files with 7 additions and 141 deletions.
6 changes: 1 addition & 5 deletions docs/TESTCASE_DEV_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@
- Set the playbook 'name' to the same name as the playbook file or test case name.
2. hosts
- Set the playbook 'hosts' to "localhost", as tasks executed on local machine, when there are tasks need to be executed on remote VM or ESXi server, use "delegate_to" keyword on the task.
3. vars_files
- Set the playbook 'vars_files' to the relative path to the configuration file "vars/test.yml", and/or other required variables file.
4. tasks
3. tasks
- This part contains "block" and "rescue" sections, write all the tasks of test case execution and validation in "block" part, "rescue" part includes a common task "common/test_rescue.yml". It means any task fails in "block" part, the testing will jump to the "rescue" part to execute failure/error handling tasks.

Below is an example of test case playbook:
```
- name: new_test_case
hosts: localhost
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions env_setup/env_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
- name: env_cleanup
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../vars/test.yml') }}"
tasks:
- name: "Set cleanup VM to False by default"
ansible.builtin.set_fact:
Expand Down
2 changes: 0 additions & 2 deletions env_setup/env_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
- name: env_setup
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../vars/test.yml') }}"
tasks:
- include_tasks: get_ansible_info.yml
- include_tasks: set_default_variables.yml
Expand Down
2 changes: 0 additions & 2 deletions linux/check_efi_firmware/check_efi_firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
- name: check_efi_firmware
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/check_inbox_driver/check_inbox_driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: check_inbox_driver
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
tasks:
- name: "Initialized inbox drivers' versions dict"
Expand Down
2 changes: 0 additions & 2 deletions linux/check_ip_address/check_ip_address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: check_ip_address
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/check_os_fullname/check_os_fullname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: check_os_fullname
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
- name: check_quiesce_snapshot_custom_script
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/cpu_hot_add_basic/cpu_hot_add_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
- name: cpu_hot_add_basic
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/cpu_multicores_per_socket/cpu_multicores_per_socket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
- name: cpu_multicores_per_socket
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/deploy_vm/deploy_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
gather_facts: false
collections:
- community.general
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Set current test case index, name and log folder"
include_tasks: ../../common/set_current_testcase_facts.yml
Expand Down
2 changes: 0 additions & 2 deletions linux/device_list/device_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
- name: device_list
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/export_vm/export_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: export_ovf
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
# Check VM power status
- include_tasks: ../../common/vm_get_power_state.yml
Expand Down
2 changes: 0 additions & 2 deletions linux/guest_customization/gosc_cloudinit_dhcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: gosc_cloudinit_dhcp
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
ip_assignment: "dhcp"
gosc_workflow: "cloud-init"
Expand Down
2 changes: 0 additions & 2 deletions linux/guest_customization/gosc_cloudinit_staticip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: gosc_cloudinit_staticip
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
ip_assignment: "static"
gosc_workflow: "cloud-init"
Expand Down
2 changes: 0 additions & 2 deletions linux/guest_customization/gosc_perl_dhcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: gosc_perl_dhcp
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
ip_assignment: "dhcp"
gosc_workflow: "perl"
Expand Down
2 changes: 0 additions & 2 deletions linux/guest_customization/gosc_perl_staticip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: gosc_perl_staticip
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
ip_assignment: "static"
gosc_workflow: "perl"
Expand Down
2 changes: 0 additions & 2 deletions linux/memory_hot_add_basic/memory_hot_add_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
- name: memory_hot_add_basic
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/network_device_ops/e1000_network_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: e1000_network_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
adapter_type: "e1000"
tasks:
Expand Down
2 changes: 0 additions & 2 deletions linux/network_device_ops/e1000e_network_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
- name: e1000e_network_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
adapter_type: "e1000e"
tasks:
Expand Down
2 changes: 0 additions & 2 deletions linux/network_device_ops/pvrdma_network_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
- name: pvrdma_network_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
timestamp: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}"
adapter_type: "pvrdma"
Expand Down
2 changes: 0 additions & 2 deletions linux/network_device_ops/vmxnet3_network_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
- name: vmxnet3_network_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
adapter_type: "vmxnet3"
tasks:
Expand Down
2 changes: 0 additions & 2 deletions linux/nvdimm_cold_add_remove/nvdimm_cold_add_remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: nvdimm_cold_add_remove
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- include_tasks: ../setup/test_setup.yml
Expand Down
2 changes: 0 additions & 2 deletions linux/open_vm_tools/ovt_verify_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
- name: ovt_verify_install
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/open_vm_tools/ovt_verify_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
- name: ovt_verify_status
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- include_tasks: ../setup/test_setup.yml
Expand Down
2 changes: 0 additions & 2 deletions linux/open_vm_tools/ovt_verify_uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: ovt_verify_uninstall
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/secureboot_enable_disable/secureboot_enable_disable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
- name: secureboot_enable_disable
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/stat_balloon/stat_balloon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
- name: stat_balloon
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/stat_hosttime/stat_hosttime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
- name: stat_hosttime
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/vgauth_check_service/vgauth_check_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: vgauth_check_service
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions linux/vhba_hot_add_remove/lsilogic_vhba_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
- name: lsilogic_vhba_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M-%S') }}"
new_disk_ctrl_type: "lsilogic"
Expand Down
2 changes: 0 additions & 2 deletions linux/vhba_hot_add_remove/lsilogicsas_vhba_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
- name: lsilogicsas_vhba_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M-%S') }}"
new_disk_ctrl_type: "lsilogicsas"
Expand Down
2 changes: 0 additions & 2 deletions linux/vhba_hot_add_remove/nvme_vhba_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
- name: nvme_vhba_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M-%S') }}"
new_disk_ctrl_type: "nvme"
Expand Down
2 changes: 0 additions & 2 deletions linux/vhba_hot_add_remove/paravirtual_vhba_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
- name: paravirtual_vhba_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M-%S') }}"
new_disk_ctrl_type: "paravirtual"
Expand Down
2 changes: 0 additions & 2 deletions linux/vhba_hot_add_remove/sata_vhba_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
- name: sata_vhba_device_ops
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
vars:
timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M-%S') }}"
new_disk_ctrl_type: "sata"
Expand Down
4 changes: 4 additions & 0 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- name: main
hosts: localhost
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 }}"
Expand Down
2 changes: 0 additions & 2 deletions windows/check_efi_firmware/check_efi_firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: check_efi_firmware
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- include_tasks: ../setup/test_setup.yml
Expand Down
2 changes: 0 additions & 2 deletions windows/check_inbox_driver/check_inbox_driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: check_inbox_driver
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- name: "Test case block"
block:
Expand Down
2 changes: 0 additions & 2 deletions windows/check_ip_address/check_ip_address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: check_ip_address
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- include_tasks: ../setup/test_setup.yml
Expand Down
2 changes: 0 additions & 2 deletions windows/check_os_fullname/check_os_fullname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- name: check_os_fullname
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- include_tasks: ../setup/test_setup.yml
Expand Down
2 changes: 0 additions & 2 deletions windows/check_quiesce_snapshot/check_quiesce_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
- name: check_quiesce_snapshot
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- include_tasks: ../setup/test_setup.yml
Expand Down
2 changes: 0 additions & 2 deletions windows/cpu_hot_add_basic/cpu_hot_add_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
- name: cpu_hot_add_basic
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- include_tasks: ../setup/test_setup.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
- name: cpu_multicores_per_socket
hosts: localhost
gather_facts: false
vars_files:
- "{{ testing_vars_file | default('../../vars/test.yml') }}"
tasks:
- block:
- name: Set fact of the initial CPU number
Expand Down
Loading

0 comments on commit b0db6c8

Please sign in to comment.