Initial commit
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
# Borgbackup Test
|
||||
|
||||
### Example of use
|
||||
```
|
||||
git clone https://gitlab.resds.ru/vlasov.dv/borgbackup-test.git
|
||||
cd borgbackup-test
|
||||
chmod +x create-vm.sh
|
||||
./create-vm.sh --bootstrap-env env
|
||||
vi env
|
||||
sudo ./create-vm.sh -e ./env
|
||||
```
|
||||
|
||||
### Usage of `./create-vm.sh`:
|
||||
```
|
||||
usage:
|
||||
./create-vm.sh required_args [optional_args] OR
|
||||
./create-vm.sh misc_args
|
||||
|
||||
Create a new virtual machine according to specified parameters and run
|
||||
test on filesystem
|
||||
|
||||
misc_args:
|
||||
--bootstrap-env ENV_PATH create template env file and exit
|
||||
|
||||
required_args:
|
||||
-n, --name NAME name of a virtual machine
|
||||
-o, --os-variant OS_VARIANT operating system
|
||||
-m, --memory MEMORY RAM size
|
||||
-c, --vcpus VCPUS Amount of of cores
|
||||
-i, --image IMAGE URL or path to an ISO image
|
||||
-s, --size SIZE Size of an OS drive (example: 8G)
|
||||
-b, --bridge BRIDGE bridge name (LinuxBridge only)
|
||||
-a, --ip-address IP ip address of eth0
|
||||
-p, --prefix PREFIX network prefix
|
||||
-g, --gateway GATEWAY ip address of network gateway
|
||||
-d, --dns DNS ip address of dns server
|
||||
-S, --source-dev SOURCE_DEV size of the created image for
|
||||
performing a test on it
|
||||
-f, --fstype FSTYPE filesystem type
|
||||
default: xfs
|
||||
|
||||
optional_args:
|
||||
-h, --help show this help message and exit
|
||||
-e, --env export args from env file
|
||||
-r, --rm-if-exist if vm exist, remove it first
|
||||
default: false
|
||||
-P, --pubkey PUBKEY place public key into autorized_keys of
|
||||
all defined in config.yaml users
|
||||
default: /home/$USER/.ssh/id_rsa.pub
|
||||
-v, --vnc-password VNC_PASSWORD vnc console password
|
||||
default: PASSWD1!
|
||||
-C, --cloud-init CLOUD_INIT Path to a cloud-init config - will be
|
||||
created if not provided
|
||||
|
||||
env example:
|
||||
NAME=Ubuntu22.04
|
||||
OS_VARIANT=ubuntu22.04
|
||||
MEMORY=5000
|
||||
VCPUS=2
|
||||
IMAGE=https://cloud-images.ubuntu.com/jammy/20231012/jammy-server-cloudimg-amd64.img
|
||||
SIZE=8G
|
||||
BRIDGE=virbr0
|
||||
IP=192.168.122.2
|
||||
PREFIX=24
|
||||
GATEWAY=192.168.122.1
|
||||
DNS=8.8.8.8
|
||||
SOURCE_DEV=/dev/vdb # CHANGE IT!
|
||||
FSTYPE=xfs
|
||||
RM=true
|
||||
PUBKEY=/root/.ssh/id_rsa.pub
|
||||
VNC_PASSWORD=PASSWD1!
|
||||
|
||||
|
||||
cloud-init example:
|
||||
#cloud-config
|
||||
package_upgrade: false
|
||||
packages:
|
||||
- vim
|
||||
- htop
|
||||
- borgbackup
|
||||
users:
|
||||
- name: ubuntu
|
||||
ssh-authorized-keys:
|
||||
- {{PUBKEY}}
|
||||
sudo: ['ALL=(ALL) NOPASSWD:ALL']
|
||||
ssh_pwauth: true
|
||||
lock-passwd: false
|
||||
chpasswd: {expire: False}
|
||||
groups: sudo
|
||||
shell: /bin/bash
|
||||
- name: adminuser
|
||||
ssh-authorized-keys:
|
||||
- {{PUBKEY}}
|
||||
sudo: ['ALL=(ALL) NOPASSWD:ALL']
|
||||
ssh_pwauth: true
|
||||
lock-passwd: false
|
||||
chpasswd: {expire: False}
|
||||
groups: sudo
|
||||
shell: /bin/bash
|
||||
runcmd:
|
||||
- wipefs -a /dev/{{DEV_INTERNAL_NAME}}
|
||||
- mkfs.{{FSTYPE}} /dev/{{DEV_INTERNAL_NAME}}
|
||||
- mkdir -p {{TESTDIR}}
|
||||
- mount /dev/{{DEV_INTERNAL_NAME}} {{TESTDIR}}
|
||||
- borg init -e none {{TESTDIR}}
|
||||
- dd if=/dev/urandom bs=2G count=1 | borg create -v -C zstd --stats {{TESTDIR}}::TESTARCHIVE_A - --stdin-name test
|
||||
- dd if=/dev/urandom bs=2G count=1 | borg create -v -C zstd --stats {{TESTDIR}}::TESTARCHIVE_B - --stdin-name test
|
||||
- dd if=/dev/urandom bs=2G count=1 | borg create -v -C zstd --stats {{TESTDIR}}::TESTARCHIVE_C - --stdin-name test
|
||||
```
|
||||
Reference in New Issue
Block a user