summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/remove_scale_group.yml
blob: 55d1af2b5ab8857d6777995cbe9bf03bad95be52 (plain)
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
---
- name: fetch the scale groups
  ec2_asg_facts:
    region: "{{ openshift_aws_region }}"
    tags:
      "{{ {'kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid,
           'version': openshift_aws_current_version} }}"
  register: qasg

- name: remove non-master scale groups
  ec2_asg:
    region: "{{ openshift_aws_region }}"
    state: absent
    name: "{{ item.auto_scaling_group_name }}"
  when: "'master'  not in item.auto_scaling_group_name"
  register: asg_results
  with_items: "{{ qasg.results }}"
  async: 600
  poll: 0

- name: join the asynch scale group removals
  async_status:
    jid: "{{ item.ansible_job_id }}"
  register: jobs_results
  with_items: "{{ asg_results.results }}"
  until: jobs_results.finished
  retries: 200