Last active
August 29, 2015 14:05
-
-
Save chantra/72f7fe1e3bc7fe2ce7af 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
#!/bin/bash | |
CHEF_ROOT=/usr/local/chef | |
VG=vg | |
wget http://www.opscode.com/chef/install.sh -O - | bash | |
mkdir /etc/chef ${CHEF_ROOT} | |
cat <<EOF > /etc/chef/solo.rb | |
chef_root_path '${CHEF_ROOT}' | |
cookbook_path [chef_root_path + '/cookbooks', chef_root_path + '/site-cookbooks'] | |
role_path chef_root_path + '/roles' | |
data_bag_path chef_root_path + '/data_bags' | |
json_attribs '/etc/chef/solo.json' | |
EOF | |
cat <<EOF > /etc/chef/solo.json | |
{ | |
"run_list": [ "role[default]"] | |
} | |
EOF | |
cat <<EOF | fdisk /dev/sda | |
n | |
p | |
t | |
3 | |
8e | |
w | |
EOF | |
cat <<EOF | fdisk /dev/sda | |
n | |
p | |
t | |
4 | |
8e | |
w | |
EOF | |
partprobe | |
pvcreate /dev/sda4 | |
vgcreate ${VG} /dev/sda4 | |
lvcreate -L 10G -n home ${VG} | |
lvcreate -L 100G -n var ${VG} | |
for lv in home var | |
do | |
mkfs.ext4 /dev/${VG}/${lv} | |
cat <<EOF >> /etc/fstab | |
/dev/${VG}/${lv} ${lv} ext4 defaults 0 0 | |
EOF | |
done | |
mkdir /tmp/var | |
mount /dev/${VG}/var /tmp/var | |
rsync -av /var/ /tmp/var/ | |
umount /tmp/var | |
rm -rf /tmp/var | |
rm -rf /var/* | |
for lv in home var | |
do | |
mount /${lv} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment