From e3a971b02689ede1955c97f51d17f43bc06b9ac1 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Fri, 15 Dec 2023 11:49:19 +0100 Subject: [PATCH] Refactor vm_count in tests provisioning --- tests/cloud_playbooks/roles/packet-ci/tasks/main.yml | 4 ---- tests/cloud_playbooks/roles/packet-ci/vars/main.yml | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 tests/cloud_playbooks/roles/packet-ci/vars/main.yml diff --git a/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml b/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml index f0329e09db8..f2dea7f6bef 100644 --- a/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml +++ b/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml @@ -3,10 +3,6 @@ - name: "Include custom vars for ci job: {{ ci_job_name }}" include_vars: "../files/{{ ci_job_name }}.yml" -- name: Set VM count needed for CI test_id - set_fact: - vm_count: "{%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale', 'ha-recover', 'ha-recover-noquorum'] -%}{{ 3 | int }}{%- elif mode == 'all-in-one' -%}{{ 1 | int }}{%- else -%}{{ 2 | int }}{%- endif -%}" - - name: Cleamup old VMs import_tasks: cleanup-old-vms.yml diff --git a/tests/cloud_playbooks/roles/packet-ci/vars/main.yml b/tests/cloud_playbooks/roles/packet-ci/vars/main.yml new file mode 100644 index 00000000000..14cf5917c87 --- /dev/null +++ b/tests/cloud_playbooks/roles/packet-ci/vars/main.yml @@ -0,0 +1,12 @@ +--- +_vm_count_dict: + separate: 3 + separate-scale: 3 + ha: 3 + ha-scale: 3 + ha-recover: 3 + ha-recover-noquorum: 3 + all-in-one: 1 + default: 2 + +vm_count: "{{ _vm_count_dict[mode | d('default')] }}"