---
|
- import_playbook: ../../setup_runtime.yml
|
|
- name: Build inventory
|
hosts: localhost
|
connection: local
|
gather_facts: False
|
become: no
|
tasks:
|
- when: cloud_provider == 'ec2'
|
block:
|
- name: Run infra-ec2-create-inventory Role
|
include_role:
|
name: infra-ec2-create-inventory
|
|
- name: Run Common SSH Config Generator Role
|
include_role:
|
name: infra-common-ssh-config-generate
|
when: "'bastions' in groups"
|
|
- name: Destroy OCP 4 resources using the installer
|
hosts: bastions
|
gather_facts: false
|
become: no
|
run_once: yes
|
tasks:
|
- name: set facts for remote access
|
set_fact:
|
ansible_ssh_extra_args: >-
|
{{ ansible_ssh_extra_args|d() }}
|
-F {{hostvars.localhost.output_dir}}/{{ env_type }}_{{ guid }}_ssh_conf
|
|
- name: Pack an archive of everything in case something goes wrong
|
archive:
|
path: /home/{{ansible_user}}
|
dest: /tmp/home.tar.gz
|
|
- fetch:
|
flat: yes
|
src: /tmp/home.tar.gz
|
dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}_{{ guid }}_user_home.tar.gz"
|
|
- name: destroy terraform resources (target directory)
|
command: openshift-install destroy cluster --dir=/home/{{ ansible_user }}/cluster-{{ guid }}/
|
register: destroyr
|
|
- name: Pack an archive of everything
|
archive:
|
path: /home/{{ansible_user}}/cluster-{{ guid }}
|
dest: /tmp/cluster-{{ guid }}.tar.gz
|
|
- fetch:
|
flat: yes
|
src: /tmp/cluster-{{ guid }}.tar.gz
|
dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}_{{ guid }}_cluster-{{ guid }}.tar.gz"
|
|
|
- name: Delete ocp4 provisioner stack
|
hosts: localhost
|
connection: local
|
gather_facts: False
|
become: no
|
tasks:
|
- name: Run infra-ec2-template-destroy
|
include_role:
|
name: infra-ec2-template-destroy
|