version: '2.0'
test_demo:
    type: direct
 
    input:
      - projects

    tasks:
      get_vms:
        with-items: project in <% $.projects %>
        action: nova.servers_list search_opts={ 'tenant_id':<% $.project %> }
        publish:
          vm_ids: <% task(get_vms).result[0].id %>
        on-success:
          - delete_vms

      delete_vms:
        with-items: id in <% $.vm_ids %>
        action: nova.servers_get_password server=<% $.id %>

Add a code snippet to your website: www.paste.org