Browse Source

First commit. Most of the base stuff is done. I'm going to sleep..

master
Blagovest Petrov 11 years ago
parent
commit
d2f8b13372
  1. 35
      cookbooks/op/recipes/base.rb
  2. 37
      cookbooks/op/recipes/mount-disks.rb
  3. 16
      cookbooks/op/recipes/webserver.rb
  4. 15
      deploy.sh
  5. 8
      homenet.json
  6. 18
      install.sh
  7. 3
      solo.rb

35
cookbooks/op/recipes/base.rb

@ -0,0 +1,35 @@
hostname = 'eniac-homenet'
DQDN = 'homenet.petrovs.info'
file '/etc/hostname' do
content "#{hostname}\n"
end
file '/etc/hosts' do
content "
127.0.0.1 localhost\n
127.0.1.1 #{DQDN} #{hostname}\n
"
end
##Install some base packages:
#Version Controls
package 'git'
package 'subversion'
#Development Tools
package 'build-essential'
#NTP:
package 'ntp'
#Utilities and some fun
package 'nano'
package 'iptraf'
package 'nmap'
package 'traceroute'
package 'tcpdump'
package 'cowsay'
package 'sl'

37
cookbooks/op/recipes/mount-disks.rb

@ -0,0 +1,37 @@
#Install Acces Control Lists
package 'acl'
#Create mount points
directory '/mnt/stardisk'
directory '/mnt/disk500'
directory '/mnt/mp3disk'
directory '/mnt/contrast'
directory '/mnt/usbdisk'
mount '/mnt/stardisk' do
device 'a9cf36f9-7c47-4651-b825-870aa2285970'
device_type :uuid
fstype 'ext4'
options 'acl,defaults'
end
mount '/mnt/disk500' do
device 'bfc79fbf-486f-481a-9c62-3fe999a9c1a1'
device_type :uuid
fstype 'ext4'
options 'defaults'
end
##Given to Stilyana
#mount '/mnt/mp3disk' do
# device '67467d42-8ad1-4a22-9668-27fe0da0401b'
# device_type :uuid
# fstype 'ext4'
# options 'defaults'
#end
mount '/mnt/usbdisk' do
device '5def2dbf-8f25-4e50-bbc6-365c68dbeaa1'
device_type :uuid
fstype 'ext4'
options 'defaults'

16
cookbooks/op/recipes/webserver.rb

@ -0,0 +1,16 @@
#Install NgInx
package 'nginx'
#Install PHP
pacakge 'php5'
package 'php5-cli'
package 'php5-fpm'
package 'php5-sqlite'
package 'php5-curl'
package 'php5-gd'
package 'php5-mysql'
package 'php5-intl'
package 'smbclient' #for OwnCloud
package 'curl'
package 'libcurl3'

15
deploy.sh

@ -0,0 +1,15 @@
#!/bin/bash
# Usage: ./deploy.sh [host]
host="${1:-blago@10.28.6.91}"
ssh-keygen -R "${host#*@}" 2> /dev/null
tar cj . | ssh -o 'StrictHostKeyChecking no' "$host" '
sudo rm -rf ~/chef &&
mkdir ~/chef &&
cd ~/chef &&
tar xj &&
sudo bash install.sh'

8
homenet.json

@ -0,0 +1,8 @@
{
"run_list": [
"recipe[base]",
"recipe[mount-disks]",
"recipe[webserver]",
"recipe[transmission-daemon]"
]
}

18
install.sh

@ -0,0 +1,18 @@
#!/bin/bash
chef_binary=`which chef-solo`
#Install chef if necessary
if ! test -f "$chef_binary"; then
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update &&
sudo apt-get -o Dpkg::Options::="--force-confnew" \
--force-yes -fuy upgrade &&
sudo apt-get install -y ruby ruby1.8-dev build-essential wget libruby1.8 rubygems
sudo gem update --no-rdoc --no-ri
sudo gem install ohai chef --no-rdoc --no-ri
fi
"$chef_binary" -c solo.rb -j homenet.json

3
solo.rb

@ -0,0 +1,3 @@
file_cache_path "/home/blago/chef"
cookbook_path "/home/blago/chef/cookbooks"
json_attribs "/home/blago/chef/homenet.json
Loading…
Cancel
Save