Skip to content

Instantly share code, notes, and snippets.

@chantra chantra/postinst.sh
Last active Aug 29, 2015

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.