AP
Size: a a a
AP
S
NM
S
NM
S
И
NM
S
NM
NM
S
NM
NM
VP
tasks:
- name: Create directory
file:
path: /tmp/images
state: directory
- name: Upload files
copy:
src: '{{ item }}'
dest: /tmp/images/
with_items:
- '{{ images_src }}/partitions.bin'
- '{{ images_src }}/vda1.img.gz'
- '{{ images_src }}/vda2.img.gz'
- '{{ images_src }}/vda3.img.gz'
- name: Wipe all fs
shell:
cmd: '{{ item }}'
with_items:
- 'wipefs -a {{ p_device }}'
- 'wipefs -a {{ s_device }}'
- 'dd if=/dev/zero of={{ p_device }} bs=10G count=1'
- 'dd if=/dev/zero of={{ s_device }} bs=10G count=1'
- name: Decompress images
shell:
cmd: '{{ item }}'
with_items:
- gunzip -c /tmp/images/vda1.img.gz > /tmp/images/vda1.img
- gunzip -c /tmp/images/vda2.img.gz > /tmp/images/vda2.img
- gunzip -c /tmp/images/vda3.img.gz > /tmp/images/vda3.img
- name: Restore partitions
shell:
cmd: '{{ item }}'
with_items:
- 'parted {{ p_device }} mklabel gpt'
- 'sgdisk --load-backup=/tmp/images/partitions.bin {{ p_device }}'
- 'sgdisk -G {{ p_device }}'
- 'dd if=/tmp/images/vda1.img of={{ p_device }}{{ part_prefix }}1'
- 'dd if=/tmp/images/vda2.img of={{ p_device }}{{ part_prefix }}2'
- 'dd if=/tmp/images/vda3.img of={{ p_device }}{{ part_prefix }}3'
- 'partprobe'
AP
VP
NM
VP
NM