1234567891011121314151617181920212223242526272829303132333435 |
- ---
- #
- # query asg's and determine to get details of what needs to be deleted.
- # if we find more than 1 for each type, then exit
- - name: query all asg's for this cluster
- ec2_asg_facts:
- region: "{{ openshift_aws_region }}"
- tags: "{{ {'kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid} | combine(openshift_aws_node_group.tags) }}"
- register: asgs
- - fail:
- msg: "Found more than 1 auto scaling group that matches the query for group: {{ openshift_aws_node_group }}"
- when:
- - asgs.results|length > 1
- - debug:
- msg: "{{ asgs }}"
- verbosity: 1
- # if re-running deprovisioning, the scale group/launch config may have already
- # been removed
- - name: delete launch configs and scale groups
- when: asgs.results|length == 1
- block:
- - name: save launch config and scale group names
- set_fact:
- l_delete_sg_launch_config_name: "{{ asgs.results[0].launch_config_name }}"
- l_delete_sg_name: "{{ asgs.results[0].auto_scaling_group_name }}"
- - when: openshift_aws_create_scale_group
- include_tasks: uninstall_scale_group.yml
- - when: openshift_aws_create_launch_config
- include_tasks: uninstall_launch_config.yml
|