summaryrefslogtreecommitdiff
path: root/chef/examples/sample_recipe.rb
blob: 6abb31bfcd9c9173431130ac3dfc79f5087e3c5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require_recipe "openldap"
require_recipe "openldap::client"
require_recipe "openldap::server"
require_recipe "resolver"
require_recipe "base"

exec "restart-apache" do
  path "/usr/bin:/usr/local/bin"
  command "/etc/init.d/apache2 restart"
  action :nothing
end

service "apache2" do
  insure "running"
  has_restart true
end

file "/etc/nsswitch.conf" do 
  owner  "root"
  group  "root" 
  mode   0644
  notifies :restart, resources("service[openldap]"), :immediately
end

service "apache2" do
  action "enabled"
  subscribes :restart, resources("/etc/nsswitch.conf"), :immediately
end

file "/etc/ldap.conf" do
  owner    "root"
  group    "root"
  mode     0644
end

file "/srv/monkey" do
  insure   "present"
  owner    "root"
  group    "root"
  mode     0644
end

file "/srv/owl" do
  insure   "present"
  owner    "root"
  group    "root"
  mode     0644
end

file "/srv/zen" do
  insure   "absent"
end

# 
# file "/srv/monkey" do |f|
#   f.insure = "present"
#   f.owner = "adam"
#   f.group = "adam"
#   f.mode = 0644
#   f.before = resources(:file => "/etc/nsswitch.conf")
# end
# 
# file "/etc/ldap-nss.conf" do |f|
#   f.insure   = "present"
#   f.owner    = "root"
#   f.group    = "root"
#   f.mode     = 0644
#   f.notifies = :refresh, resources(:file => "/etc/ldap.conf")
# end
# 
# file "/etc/coffee.conf" do |f|
#   f.insure   = "present"
#   f.owner    = "root"
#   f.group    = "root"
#   f.mode     = 0644
#   f.subscribes = :polio, resources(:file => "/etc/nsswitch.conf")
# end