2022-08-05 14:03:38 +02:00
|
|
|
---
|
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-05-29 21:16:23 +02:00
|
|
|
- name: "Create volume group on first disk"
|
|
|
|
lvg:
|
|
|
|
vg: testvg
|
2022-12-21 07:31:46 +01:00
|
|
|
pvs: "{{ loop_device1 }}"
|
2020-05-29 21:16:23 +02:00
|
|
|
|
|
|
|
- name: Gets current vg size
|
|
|
|
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
|
|
|
register: cmd_result
|
|
|
|
|
2023-08-12 11:39:59 +02:00
|
|
|
- name: Assert the testvg size is 33554432B
|
2020-05-29 21:16:23 +02:00
|
|
|
assert:
|
|
|
|
that:
|
2023-08-12 11:39:59 +02:00
|
|
|
- "'33554432B' == cmd_result.stdout"
|
2020-05-29 21:16:23 +02:00
|
|
|
|
|
|
|
- name: Increases size in file
|
|
|
|
command: "dd if=/dev/zero bs=8MiB count=1 of={{ remote_tmp_dir }}/img1 conv=notrunc oflag=append"
|
|
|
|
|
|
|
|
- name: "Reread size of file associated with loop_device1"
|
2022-12-21 07:31:46 +01:00
|
|
|
command: "losetup -c {{ loop_device1 }}"
|
2020-05-29 21:16:23 +02:00
|
|
|
|
|
|
|
- name: "Reruns lvg with pvresize:no"
|
|
|
|
lvg:
|
|
|
|
vg: testvg
|
2022-12-21 07:31:46 +01:00
|
|
|
pvs: "{{ loop_device1 }}"
|
2023-02-15 22:55:23 +01:00
|
|
|
pvresize: false
|
2020-05-29 21:16:23 +02:00
|
|
|
register: cmd_result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- cmd_result is not changed
|
|
|
|
|
|
|
|
- name: Gets current vg size
|
|
|
|
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
|
|
|
register: cmd_result
|
|
|
|
|
2023-08-12 11:39:59 +02:00
|
|
|
- name: Assert the testvg size is still 33554432B
|
2020-05-29 21:16:23 +02:00
|
|
|
assert:
|
|
|
|
that:
|
2023-08-12 11:39:59 +02:00
|
|
|
- "'33554432B' == cmd_result.stdout"
|
2020-05-29 21:16:23 +02:00
|
|
|
|
|
|
|
- name: "Reruns lvg with pvresize:yes and check_mode:yes"
|
|
|
|
lvg:
|
|
|
|
vg: testvg
|
2022-12-21 07:31:46 +01:00
|
|
|
pvs: "{{ loop_device1 }}"
|
2023-02-15 22:55:23 +01:00
|
|
|
pvresize: true
|
|
|
|
check_mode: true
|
2020-05-29 21:16:23 +02:00
|
|
|
register: cmd_result
|
|
|
|
|
|
|
|
- name: Assert that the module returned the state was changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- cmd_result is changed
|
|
|
|
|
|
|
|
- name: Gets current vg size
|
|
|
|
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
|
|
|
register: cmd_result
|
|
|
|
|
2023-08-12 11:39:59 +02:00
|
|
|
- name: Assert the testvg size is still 33554432B
|
2020-05-29 21:16:23 +02:00
|
|
|
assert:
|
|
|
|
that:
|
2023-08-12 11:39:59 +02:00
|
|
|
- "'33554432B' == cmd_result.stdout"
|
2020-05-29 21:16:23 +02:00
|
|
|
|
|
|
|
- name: "Reruns lvg with pvresize:yes"
|
|
|
|
lvg:
|
|
|
|
vg: testvg
|
2022-12-21 07:31:46 +01:00
|
|
|
pvs: "{{ loop_device1 }}"
|
2023-02-15 22:55:23 +01:00
|
|
|
pvresize: true
|
2020-05-29 21:16:23 +02:00
|
|
|
|
|
|
|
- name: Gets current vg size
|
|
|
|
shell: vgs -v testvg -o pv_size --noheading --units b | xargs
|
|
|
|
register: cmd_result
|
|
|
|
|
2023-08-12 11:39:59 +02:00
|
|
|
- name: Assert the testvg size is now 41943040B
|
2020-05-29 21:16:23 +02:00
|
|
|
assert:
|
|
|
|
that:
|
2023-08-12 11:39:59 +02:00
|
|
|
- "'41943040B' == cmd_result.stdout"
|