5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 instance_disk_part: "{% if root_disk == default_rootdisk_device %}{{root_disk}}{{instance_part_number}}{% else %}{{root_disk}}-part{{instance_part_number}}{% endif %}"
21 msg: "instance partition: {{ instance_disk_part }}"
23 - name: get volume pools
24 shell: dmsetup ls | awk '/volumes/ {print $1}'
25 register: volume_pools
29 msg: "volume pools: {{ volume_pools.stdout_lines }}"
31 - name: remove volume pools 1 round
32 shell: dmsetup remove {{ item }}
33 with_items: "{{ volume_pools.stdout_lines }}"
35 when: volume_pools.stdout_lines
37 - name: get volume pools
38 shell: dmsetup ls | awk '/volumes/ {print $1}'
39 register: volume_pools
43 msg: "volume pools: {{ volume_pools.stdout_lines }}"
45 - name: remove volume pools 2 round
46 shell: dmsetup remove {{ item }}
47 with_items: "{{ volume_pools.stdout_lines }}"
49 when: volume_pools.stdout_lines
51 - name: get volume groups
52 shell: "vgs -o vg_name --noheadings | sed 's/ //g'"
53 register: volumegroups
56 msg: "volume groups: {{ volumegroups.stdout_lines }}"
58 - name: remove volume groups
59 lvg: vg={{ item }} state=absent force=yes
61 with_items: "{{ volumegroups.stdout_lines }}"
63 - volumegroups.stdout_lines
66 - name: remove physical volume (if any)
67 shell: pvremove {{ instance_disk_part }}
70 - name: get volume groups
71 shell: "vgs -o vg_name --noheadings | sed 's/ //g'"
72 register: volumegroups
76 msg: "volume groups: {{ volumegroups.stdout_lines }}"
78 - name: get volume pools
79 shell: dmsetup ls | awk '{print $1}'
80 register: volume_pools
84 msg: "volume pools: {{ volume_pools.stdout_lines }}"