Created
August 11, 2019 06:36
-
-
Save patsevanton/707c9eba3b386814cf9e837301bd3fff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sdb1 = <<-SCRIPT | |
parted /dev/sdb mklabel msdos | |
parted /dev/sdb mkpart primary 0% 100% | |
mkfs.xfs /dev/sdb1 | |
mkdir /mnt/data1 | |
if grep -Fxq "sdb1" /etc/fstab | |
then | |
echo 'sdb1 exist in fstab' | |
else | |
echo `blkid /dev/sdb1 | awk '{print$2}' | sed -e 's/"//g'` /mnt/data1 xfs noatime,nobarrier 0 0 >> /etc/fstab | |
fi | |
if mount | grep /mnt/data1 > /dev/null; then | |
echo "/dev/sdb1 mounted /mnt/data1" | |
umount /mnt/data1 | |
mount /mnt/data1 | |
else | |
mount /mnt/data1 | |
fi | |
SCRIPT | |
node1disk1 = "./tmp/node1disk1.vdi"; | |
node1disk2 = "./tmp/node1disk2.vdi"; | |
node1disk3 = "./tmp/node1disk3.vdi"; | |
ip_node1 = "192.168.33.31"; | |
Vagrant.configure("2") do |config| | |
config.vm.define "node1" do |node1| | |
node1.vm.network "private_network", ip: ip_node1 | |
node1.vm.hostname = "node1" | |
node1.vm.define "node1" | |
node1.vm.box_download_insecure = true | |
node1.vm.box = "ubuntu/bionic64" | |
node1.vm.provider "virtualbox" do |vb| | |
vb.memory = "2048" | |
if not File.exists?(node1disk1) | |
vb.customize ['createhd', '--filename', node1disk1, '--variant', 'Fixed', '--size', 1 * 1024] | |
vb.customize ['storageattach', :id, '--storagectl', 'IDE', '--port', 0, '--device', 1, '--type', 'hdd', '--medium', node1disk1] | |
end | |
end | |
node1.vm.provision "shell", inline: $sdb1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment