---
- name: terminate instance
  hosts: all
  user: root
  gather_facts: False

  vars_files:
  - nova_cloud_vars.yml

  vars:
  - OS_USERNAME_OLD: msuchy
  - OS_AUTH_URL_OLD: http://172.23.0.2:5000/v2.0
  # todo: remove after transition to new cloud

  tasks:
  - name: terminate it
    local_action: nova_compute auth_url={{OS_AUTH_URL_OLD}} login_password={{OS_PASSWORD}} login_tenant_name={{OS_TENANT_NAME}} login_username={{OS_USERNAME_OLD}} name="{{copr_task.vm_name}}" state=absent
