Skip to content

Instantly share code, notes, and snippets.

@dgadiraju
Last active October 16, 2018 16:11
Show Gist options
  • Save dgadiraju/55d5c81b319748502bfcfab78f3602d5 to your computer and use it in GitHub Desktop.
Save dgadiraju/55d5c81b319748502bfcfab78f3602d5 to your computer and use it in GitHub Desktop.
#Do not run this script unless you understand what it is doing
#Do not run this script more than once
echo -e "o\nn\np\n1\n\n\nw" | sudo fdisk /dev/sdb
sudo mkfs.ext4 -F /dev/sdb
sudo mkdir /data1
sudo sh -c "echo -e \"/dev/sdb /data1 ext4 defaults 0 0\" >> /etc/fstab"
sudo mount -a
# Make sure contents of format_disk.sh is copied into a file called format_disk.sh
# Run these commands via ssh
# Do not run these commands on same node more than once
ansible all \
-i hosts \
-m script \
-a "scripts/format_disk.sh" \
--private-key=~/.ssh/google_compute_engine \
--become
ansible all \
-i hosts \
-a "df -h" \
--private-key=~/.ssh/google_compute_engine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment