terminate.yml 485 B

12345678910111213141516
  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_{{ cluster_id }}
  9. - add_host:
  10. name: "{{ item }}"
  11. groups: oo_hosts_to_terminate
  12. ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
  13. ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
  14. with_items: groups[scratch_group] | default([]) | difference(['localhost'])
  15. - include: ../terminate.yml