X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/b20599b6503be65674c3e420be6cca91b507ac0a..9d27360314f8e4e9844cde4059f98fac52250d36:/cookbooks/openvpn/recipes/default.rb diff --git a/cookbooks/openvpn/recipes/default.rb b/cookbooks/openvpn/recipes/default.rb index a1a52f13e..9b01bfdb9 100644 --- a/cookbooks/openvpn/recipes/default.rb +++ b/cookbooks/openvpn/recipes/default.rb @@ -20,14 +20,14 @@ package "openvpn" service "openvpn" do - action [ :enable, :start ] + action [:enable, :start] supports :status => true, :restart => true, :reload => true ignore_failure true end -node[:openvpn][:tunnels].each do |name,details| +node[:openvpn][:tunnels].each do |name, details| if peer = search(:node, "fqdn:#{details[:peer][:host]}").first - if peer[:openvpn] and not details[:peer][:address] + if peer[:openvpn] && !details[:peer][:address] node.default[:openvpn][:tunnels][name][:peer][:address] = peer[:openvpn][:address] end @@ -49,7 +49,7 @@ node[:openvpn][:tunnels].each do |name,details| if File.exist?("/etc/openvpn/#{name}.key") node.set[:openvpn][:keys][name] = IO.read("/etc/openvpn/#{name}.key") end - elsif peer and peer[:openvpn] + elsif peer && peer[:openvpn] file "/etc/openvpn/#{name}.key" do owner "root" group "root" @@ -65,10 +65,10 @@ node[:openvpn][:tunnels].each do |name,details| group "root" mode 0644 variables :name => name, - :address => node[:openvpn][:address], - :port => node[:openvpn][:tunnels][name][:port], - :mode => node[:openvpn][:tunnels][name][:mode], - :peer => node[:openvpn][:tunnels][name][:peer] + :address => node[:openvpn][:address], + :port => node[:openvpn][:tunnels][name][:port], + :mode => node[:openvpn][:tunnels][name][:mode], + :peer => node[:openvpn][:tunnels][name][:peer] notifies :restart, "service[openvpn]" end else