| | |
| | | openstack project purge --keep-project --project {{ osp_project_name }} |
| | | when: project_purge_out is succeeded |
| | | |
| | | - name: Delete any remaining volumes in project |
| | | shell: >- |
| | | set -o pipefail; |
| | | openstack volume list --project {{ osp_project_name }} -f value -c ID |
| | | | xargs openstack volume delete |
| | | |
| | | - name: Delete any trunk ports in project |
| | | shell: >- |
| | | set -o pipefail; |
| | | openstack port list --project {{ osp_project_name }} -f json -c trunk_details |
| | | | jq '.[].trunk_details.trunk_id | select (.!=null)' |
| | | | xargs openstack network trunk delete |
| | | |
| | | - name: Get all remaining volumes in project |
| | | command: >- |
| | | openstack volume list --project {{ osp_project_name }} -f json -c ID |
| | | register: r_volumes |
| | | |
| | | - set_fact: |
| | | _all_volumes: "{{ r_volumes.stdout | from_json | list }}" |
| | | |
| | | - when: _all_volumes | length > 0 |
| | | command: |
| | | openstack volume delete {{ _all_volumes | join(' ') }} |
| | | |
| | | - name: Get all remaining trunk ports in project |
| | | command: >- |
| | | openstack port list |
| | | --project {{ osp_project_name }} |
| | | -f json -c trunk_details |
| | | register: r_ports |
| | | |
| | | - set_fact: |
| | | _all_ports: >- |
| | | {{ r_ports.stdout |
| | | | from_json |
| | | | json_query('[?trunk_details != null].trunk_details.trunk_id') |
| | | | list }} |
| | | |
| | | - when: _all_ports | length > 0 |
| | | name: Delete any trunk ports in project |
| | | command: openstack network trunk delete {{ _all_ports | join(' ') }} |
| | | |
| | | - name: Purge network resources |
| | | command: | |
| | | neutron purge --project {{ osp_project_info[0].id }} |