terminate.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. - name: Terminate instance(s)
  3. hosts: localhost
  4. gather_facts: no
  5. vars_files:
  6. - vars.yml
  7. tasks:
  8. - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-node
  9. - add_host:
  10. name: "{{ item }}"
  11. groups: oo_nodes_to_terminate
  12. ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
  13. ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
  14. with_items: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated)
  15. - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-master
  16. - add_host:
  17. name: "{{ item }}"
  18. groups: oo_masters_to_terminate
  19. ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
  20. ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
  21. with_items: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated)
  22. - include: ../openshift-node/terminate.yml
  23. vars:
  24. gce_service_account_email: "{{ lookup('env', 'gce_service_account_email_address') }}"
  25. gce_pem_file: "{{ lookup('env', 'gce_service_account_pem_file_path') }}"
  26. gce_project_id: "{{ lookup('env', 'gce_project_id') }}"
  27. - include: ../openshift-master/terminate.yml
  28. vars:
  29. gce_service_account_email: "{{ lookup('env', 'gce_service_account_email_address') }}"
  30. gce_pem_file: "{{ lookup('env', 'gce_service_account_pem_file_path') }}"
  31. gce_project_id: "{{ lookup('env', 'gce_project_id') }}"