uninstall_node_group.yml 973 B

1234567891011121314151617181920212223242526272829
  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. - name: save launch config and scale group names
  18. set_fact:
  19. l_delete_sg_launch_config_name: "{{ asgs.results[0].launch_config_name }}"
  20. l_delete_sg_name: "{{ asgs.results[0].auto_scaling_group_name }}"
  21. - when: openshift_aws_create_scale_group
  22. include_tasks: uninstall_scale_group.yml
  23. - when: openshift_aws_create_launch_config
  24. include_tasks: uninstall_launch_config.yml