I have setup some VMs on a Hypervisor. Each of which is using a raw LVM Volume as disk. This way I can use LVM Snapshots to prepare a backup. Up to this point that is working and the only missing piece of the puzzle boils down to:
How can/should I do something like this with ansible:
dd bs=16M if=/dev/h-vg/vm-dev | ssh root@serverB "dd bs=16M of=/path/to/backup.img"
I know that I can first use dd
to create the image and than ansible.builtin.fetch
to pull it down. But than I would need three times as much hard disk space as the volume I want to backup, since I need space for the snapshot and additional space for the image.
Update With regards to the Comments
I know that using the shell
module is an option (as always) but I want to make sure that there isn't any other more »ansibleish« way to do that, to avoid all the downsides of using the shell
module.
Piping data over ssh is some sort of general tool, but since ansible is managing all the »to and fro« I am curious if the is an ansible way to stream data like that.