Guillaume Coré
2018-12-17 41fa25300bd852bda74e9196b1c36a81f36382ba
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
41fa25 43     - name: destroy terraform resources (target directory)
GC 44       command: openshift-install destroy cluster --dir=/home/{{ ansible_user }}/cluster-{{ guid }}/
3c6889 45       register: destroyr
GC 46
41fa25 47     - name: Pack an archive of everything
GC 48       archive:
49         path: /home/{{ansible_user}}/cluster-{{ guid }}
50         dest: /tmp/cluster-{{ guid }}.tar.gz
3c6889 51
41fa25 52     - fetch:
GC 53         flat: yes
54         src: /tmp/cluster-{{ guid }}.tar.gz
55         dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}_{{ guid }}_cluster-{{ guid }}.tar.gz"
56
3c6889 57
GC 58 - name: Delete ocp4 provisioner stack
59   hosts: localhost
60   connection: local
61   gather_facts: False
62   become: no
63   tasks:
64     - name: Run infra-ec2-template-destroy
65       include_role:
66         name: infra-ec2-template-destroy