Guillaume Coré
2018-12-17 41fa25300bd852bda74e9196b1c36a81f36382ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
- 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