Skip to content

Commit 3912ee9

Browse files
committed
basic system installation
1 parent 29a3ee2 commit 3912ee9

File tree

7 files changed

+76
-1
lines changed

7 files changed

+76
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# techtalks.io chef solo
1+
# chef
2+
Chef solo configuration for techtalks.io
3+

cookbooks/op/recipes/default.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# --- Install packages we need ---
2+
package 'ntp'
3+
package 'git'
4+
package 'build-essential'
5+
package 'lighttpd'
6+
package 'php5'
7+
package 'php5-cli'
8+
package 'php5-dev'
9+
package 'php5-cgi'
10+
11+
# --- Set host name ---
12+
hostname = 'vps129914.ovh.net'
13+
14+
file '/etc/hostname' do
15+
content "#{hostname}\n"
16+
end
17+
18+
file '/etc/hosts' do
19+
content "127.0.0.1 localhost #{hostname}\n"
20+
end
21+
22+
directory "/opt/techtalks.io" do
23+
owner 'root'
24+
group 'root'
25+
mode '0755'
26+
action :create
27+
end
28+

cookbooks/op/recipes/user.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# --- Install packages we need ----
2+
package 'vim-nox'
3+
package 'curl'

deploy.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Usage: ./deploy.sh [host]
4+
5+
host="${1:-raul@vps129914.ovh.net}"
6+
7+
# The host key might change when we instantiate a new VM, so
8+
# we remove (-R) the old host key from known_hosts
9+
ssh-keygen -R "${host#*@}" 2> /dev/null
10+
11+
tar cj . | ssh -o 'StrictHostKeyChecking no' "$host" '
12+
sudo rm -rf ~/chef &&
13+
mkdir ~/chef &&
14+
cd ~/chef &&
15+
tar xj &&
16+
sudo bash install.sh'

install.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# This runs as root on the server
4+
5+
chef_binary=/usr/bin/chef-solo
6+
7+
# Are we on a vanilla system?
8+
if ! test -f "$chef_binary"; then
9+
export DEBIAN_FRONTEND=noninteractive
10+
# Upgrade headlessly (this is only safe-ish on vanilla systems)
11+
aptitude update &&
12+
apt-get -o Dpkg::Options::="--force-confnew" --force-yes -fuy dist-upgrade &&
13+
# Install Chef
14+
apt-get install -y chef
15+
fi &&
16+
17+
"$chef_binary" -c solo.rb -j solo.json

solo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"run_list": [
3+
"recipe[op::default]",
4+
"recipe[op::user]"
5+
]
6+
}

solo.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
root = File.absolute_path(File.dirname(__FILE__))
2+
file_cache_path root
3+
cookbook_path root + '/cookbooks'

0 commit comments

Comments
 (0)