uninstall_node_group.yml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. #
  3. # query asg's and determine to get details of what needs to be deleted.
  4. # if we find more than 1 for each type, then exit
  5. - name: query all asg's for this cluster
  6. ec2_asg_facts:
  7. region: "{{ openshift_aws_region }}"
  8. tags: "{{ {'kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid} | combine(openshift_aws_node_group.tags) }}"
  9. register: asgs
  10. - fail:
  11. msg: "Found more than 1 auto scaling group that matches the query for group: {{ openshift_aws_node_group }}"
  12. when:
  13. - asgs.results|length > 1
  14. - debug:
  15. msg: "{{ asgs }}"
  16. verbosity: 1
  17. # if re-running deprovisioning, the scale group/launch config may have already
  18. # been removed
  19. - name: delete launch configs and scale groups
  20. when: asgs.results|length == 1
  21. block:
  22. - name: save launch config and scale group names
  23. set_fact:
  24. l_delete_sg_launch_config_name: "{{ asgs.results[0].launch_config_name }}"
  25. l_delete_sg_name: "{{ asgs.results[0].auto_scaling_group_name }}"
  26. - when: openshift_aws_create_scale_group
  27. include_tasks: uninstall_scale_group.yml
  28. - when: openshift_aws_create_launch_config
  29. include_tasks: uninstall_launch_config.yml