terminate.yml 550 B

123456789101112131415161718
  1. - name: "populate oo_hosts_to_terminate host group if needed"
  2. hosts: localhost
  3. gather_facts: no
  4. tasks:
  5. - name: Evaluate oo_host_group_exp if it's set
  6. add_host: "name={{ item }} groups=oo_hosts_to_terminate"
  7. with_items: "{{ oo_host_group_exp | default('') }}"
  8. when: oo_host_group_exp is defined
  9. - name: "Terminate instances"
  10. hosts: localhost
  11. connection: local
  12. tasks:
  13. - name: Terminate master instances
  14. local_action:
  15. module: gce
  16. state: 'absent'
  17. instance_names: "{{ oo_hosts_to_terminate }}"