mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 15:04:02 -07:00
lvm_pv_move_data: new module (#10416)
* Added lvm_pv_move_data module
* Removed trailing whitespace
* Decreased loop devices file size
* Remove test VG if exists
* Force remove test VG if exists
* Renamed test VG and LV names
* Updated assert conditions
* Added .ansible to .gitignore
* Force extending VG
* Wiping LVM metadata from PVs before creating VG
* Clean FS, LV, VG and PSs before run
* Migrated to CmdRunner
* Added more detailed info in case of failure and cosmetic changes
* Remove redundant params from CmdRunner call
* Updates the RETURN documentation block to properly specify the return type
of the 'actions' field:
- Changes return status from 'always' to 'success'
- Adds missing 'elements: str' type specification
(cherry picked from commit e91e2ef6f8
)
Co-authored-by: Klention Mali <45871249+klention@users.noreply.github.com>
36 lines
1.2 KiB
YAML
36 lines
1.2 KiB
YAML
---
|
|
# 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
|
|
|
|
- name: Creating a 50MB file on the mounted LV
|
|
ansible.builtin.command: dd if=/dev/zero of={{ remote_tmp_dir }}/tmp_mount/test_file bs=1M count=50
|
|
args:
|
|
creates: "{{ remote_tmp_dir }}/tmp_mount/test_file"
|
|
|
|
- name: Growing the second loop device file to 1500MB
|
|
ansible.builtin.shell: truncate -s 1500M {{ remote_tmp_dir }}/test_lvm_pv_02.img
|
|
|
|
- name: Refreshing the second loop device
|
|
ansible.builtin.shell: losetup -c {{ loop_device_02.stdout }}
|
|
|
|
- name: Resizing the second physical volume
|
|
community.general.lvm_pv:
|
|
device: "{{ loop_device_02.stdout }}"
|
|
resize: true
|
|
|
|
- name: Moving data from between PVs (both in same VG)
|
|
community.general.lvm_pv_move_data:
|
|
source: "{{ loop_device_01.stdout }}"
|
|
destination: "{{ loop_device_02.stdout }}"
|
|
register: move_result
|
|
|
|
- name: Debugging move result
|
|
ansible.builtin.debug:
|
|
var: move_result
|
|
|
|
- name: Asserting data was moved successfully
|
|
ansible.builtin.assert:
|
|
that:
|
|
- move_result is changed
|
|
- "'moved data from' in move_result.msg"
|