-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
autofs.rb
38 lines (34 loc) · 1.04 KB
/
autofs.rb
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
package "autofs"
service "autofs" do
supports :status => true, :restart => false, :reload => true
action [ :enable, :start ]
end
template node[:opsworks_initial_setup][:autofs_map_file] do
source "automount.opsworks.erb"
mode "0444"
owner "root"
group "root"
end
ruby_block "Update autofs loglevel" do
block do
handle_to_master = Chef::Util::FileEdit.new(AutoFs.config(node))
handle_to_master.insert_line_if_no_match(
/^LOGGING=/,
"LOGGING=verbose"
)
handle_to_master.write_file
end
not_if { ::File.read(AutoFs.config(node)) =~ /^LOGGING=/ }
end
ruby_block "Update autofs configuration" do
block do
handle_to_master = Chef::Util::FileEdit.new("/etc/auto.master")
handle_to_master.insert_line_if_no_match(
node[:opsworks_initial_setup][:autofs_map_file],
"/- #{node[:opsworks_initial_setup][:autofs_map_file]} -t 3600 -n 1"
)
handle_to_master.write_file
end
notifies :restart, "service[autofs]", :immediately
not_if { ::File.read('/etc/auto.master').include?('auto.opsworks') }
end