You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1003 B

  1. ---
  2. - hosts: localhost
  3. become: false
  4. gather_facts: no
  5. vars:
  6. mode: default
  7. tasks:
  8. - name: replace_test_id
  9. set_fact:
  10. test_name: "{{test_id |regex_replace('\\.', '-')}}"
  11. - set_fact:
  12. instance_names: >-
  13. {%- if mode in ['separate', 'ha'] -%}
  14. k8s-{{test_name}}-1,k8s-{{test_name}}-2,k8s-{{test_name}}-3
  15. {%- else -%}
  16. k8s-{{test_name}}-1,k8s-{{test_name}}-2
  17. {%- endif -%}
  18. - name: delete gce instances
  19. gce:
  20. instance_names: "{{instance_names}}"
  21. image: "{{ cloud_image }}"
  22. service_account_email: "{{ gce_service_account_email }}"
  23. pem_file: "{{ gce_pem_file | default(omit)}}"
  24. credentials_file: "{{gce_credentials_file | default(omit)}}"
  25. project_id: "{{ gce_project_id }}"
  26. zone: "{{cloud_region | default('europe-west1-b')}}"
  27. metadata: '{"test_id": "{{test_id}}", "network": "{{kube_network_plugin}}"}'
  28. state: 'absent'
  29. register: gce