Guillaume Coré
2018-12-13 729b055b1705ec68b877b6299abd83cdac9b0aa1
commit | author | age
1d2130 1 ---
3c6889 2 - import_playbook: ../../setup_runtime.yml
GC 3
4 - name: Build inventory
5   hosts: localhost
6   connection: local
7   gather_facts: False
8   become: no
9   tasks:
10     - when: cloud_provider == 'ec2'
11       block:
12       - name: Run infra-ec2-create-inventory Role
13         include_role:
14           name: infra-ec2-create-inventory
15
16       - name: Run Common SSH Config Generator Role
17         include_role:
18           name: infra-common-ssh-config-generate
729b05 19         when: "'bastions' in groups"
3c6889 20
GC 21 - name: Destroy OCP 4 resources using the installer
22   hosts: bastions
23   gather_facts: false
24   become: no
25   run_once: yes
26   tasks:
27     - name: set facts for remote access
28       set_fact:
29         ansible_ssh_extra_args: >-
30           {{ ansible_ssh_extra_args|d() }}
31           -F {{hostvars.localhost.output_dir}}/{{ env_type }}_{{ guid }}_ssh_conf
32
33     - name: Pack an archive of everything in case something goes wrong
34       archive:
35         path: /home/{{ansible_user}}
36         dest: /tmp/home.tar.gz
37
38     - fetch:
39         flat: yes
40         src: /tmp/home.tar.gz
41         dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}_{{ guid }}_user_home.tar.gz"
42
43     - name: destroy terraform resources
44       command: openshift-install destroy cluster
45       register: destroyr
46
47     - name: Save output to output_dir
48       copy:
49         content: "{{ destroyr.stdout }}"
50         dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}-{{ guid }}.destroy-cluster.stdout.log"
51       delegate_to: localhost
52
53     - name: Save stderr to output_dir
54       copy:
55         content: "{{ destroyr.stderr }}"
56         dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}-{{ guid }}.destroy-cluster.stderr.log"
57       delegate_to: localhost
58
59 - name: Delete ocp4 provisioner stack
60   hosts: localhost
61   connection: local
62   gather_facts: False
63   become: no
64   tasks:
65     - name: Run infra-ec2-template-destroy
66       include_role:
67         name: infra-ec2-template-destroy