以下のVagrantfileを使用して、BorgBackupをインストールした仮想マシンを構築する事ができます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-8.1"
config.vm.hostname = "co81borgbackup"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co81borgbackup"
vbox.gui = true
vbox.cpus = 2
vbox.memory = 4096
end
config.vm.network "private_network", ip: "192.168.55.101", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
dnf -y install langpacks-ja
localectl set-locale LANG=ja_JP.UTF-8
dnf install -y epel-release
dnf check-update
dnf -y update
timedatectl set-timezone Asia/Tokyo
# install BorgBackup
dnf -y install borgbackup
# test execution
mkdir -p sample
cp /vagrant/Vagrantfile sample
# intializa repo
echo 'initialize...'
mkdir -p /opt/repo
export BORG_PASSPHRASE=vagrant
borg init -e repokey /opt/repo
# backup
echo 'backup...'
borg create --stats /opt/repo::20200330 /home/vagrant/sample/*
# show
echo 'listing...'
borg list /opt/repo::20200330
# remove original file and restore it.
echo 'restore...'
rm -f /home/vagrant/sample/Vagrantfile
borg extract /opt/repo::20200330
cat ~vagrant/home/vagrant/sample/Vagrantfile
SHELL
end
0 件のコメント:
コメントを投稿