---
- include: unregister.yaml
  when: hostvars[prefix + '-bastion'] is defined

- name: teardown the created infrastructure
  hosts: localhost
  roles:
  - registry-bucket-delete
  - dns-records-delete
  - role: deployment-delete
    deployment_name: core
  - ssl-certificate-delete
  - role: deployment-delete
    deployment_name: tmp-instance
  - temp-instance-disk-delete
  - ssh-config-tmp-instance-delete
  - role: deployment-delete
    deployment_name: network
  - ssh-proxy-delete
  - role: deployment-delete
    deployment_name: gold-image
    deployment_name_with_prefix: '{{ prefix }}-{{ deployment_name }}{{ "-origin" if openshift_deployment_type == "origin" else "" }}'
    when: delete_gold_image | bool
  - role: rhel-image-delete
    when: delete_image | bool
  - role: empty-image-delete
    when: delete_image | bool
