Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FC001 - strings instead of symbols

  • Loading branch information...
commit 8f0478513d0a08d96e478231c819aad7c2772218 1 parent 51e556c
@jtimberman jtimberman authored
View
24 attributes/default.rb
@@ -1,12 +1,12 @@
-default[:keepalived][:shared_address] = false
-default[:keepalived][:global][:notification_emails] = 'admin@example.com'
-default[:keepalived][:global][:notification_email_from] = "keepalived@#{node.domain || 'example.com'}"
-default[:keepalived][:global][:smtp_server] = '127.0.0.1'
-default[:keepalived][:global][:smtp_connect_timeout] = 30
-default[:keepalived][:global][:router_id] = 'DEFAULT_ROUT_ID'
-default[:keepalived][:global][:router_ids] = {} # node name based mapping
-default[:keepalived][:check_scripts] = {}
-default[:keepalived][:instance_defaults][:state] = 'MASTER'
-default[:keepalived][:instance_defaults][:priority] = 100
-default[:keepalived][:instance_defaults][:virtual_router_id] = 10
-default[:keepalived][:instances] = {}
+default['keepalived']['shared_address'] = false
+default['keepalived']['global']['notification_emails'] = 'admin@example.com'
+default['keepalived']['global']['notification_email_from'] = "keepalived@#{node['domain'] || 'example.com'}"
+default['keepalived']['global']['smtp_server'] = '127.0.0.1'
+default['keepalived']['global']['smtp_connect_timeout'] = 30
+default['keepalived']['global']['router_id'] = 'DEFAULT_ROUT_ID'
+default['keepalived']['global']['router_ids'] = {} # node name based mapping
+default['keepalived']['check_scripts'] = {}
+default['keepalived']['instance_defaults']['state'] = 'MASTER'
+default['keepalived']['instance_defaults']['priority'] = 100
+default['keepalived']['instance_defaults']['virtual_router_id'] = 10
+default['keepalived']['instances'] = {}
View
8 recipes/default.rb
@@ -17,11 +17,9 @@
# limitations under the License.
#
-package "keepalived" do
- action :install
-end
+package "keepalived"
-if(node[:keepalived][:shared_address])
+if node['keepalived']['shared_address']
file '/etc/sysctl.d/60-ip-nonlocal-bind.conf' do
mode 0644
content "net.ipv4.ip_nonlocal_bind=1\n"
@@ -42,5 +40,5 @@
service "keepalived" do
supports :restart => true
action [:enable, :start]
- subscribes :restart, resources(:template => "/etc/keepalived/keepalived.conf"), :delayed
+ subscribes :restart, "template[/etc/keepalived/keepalived.conf"
end
View
52 templates/default/keepalived.conf.erb
@@ -2,55 +2,55 @@
! Generated by Chef.
global_defs {
notification_email {
- <% Array(node[:keepalived][:global][:notification_emails]).each do |email| %>
+ <% Array(node['keepalived']['global']['notification_emails']).each do |email| %>
<%= email %>
<% end %>
}
- notification_email_from <%= node[:keepalived][:global][:notification_email_from] %>
- smtp_server <%= node[:keepalived][:global][:smtp_server] %>
- smtp_connect_timeout <%= node[:keepalived][:global][:smtp_connect_timeout] %>
- router_id <%= node[:keepalived][:global][:router_ids][node.name] || node[:keepalived][:global][:router_id] %>
+ notification_email_from <%= node['keepalived']['global']['notification_email_from'] %>
+ smtp_server <%= node['keepalived']['global']['smtp_server'] %>
+ smtp_connect_timeout <%= node['keepalived']['global']['smtp_connect_timeout'] %>
+ router_id <%= node['keepalived']['global']['router_ids'][node.name] || node['keepalived']['global']['router_id'] %>
}
-<% node[:keepalived][:check_scripts].each_pair do |name, script| %>
+<% node['keepalived']['check_scripts'].each_pair do |name, script| %>
vrrp_script <%= name %> {
- script "<%= script[:script] %>"
- interval <%= script[:interval] %>
- weight <%= script[:weight] %>
+ script "<%= script['script'] %>"
+ interval <%= script['interval'] %>
+ weight <%= script['weight'] %>
}
<% end %>
-<% node[:keepalived][:instances].each_pair do |name, instance| -%>
+<% node['keepalived']['instances'].each_pair do |name, instance| -%>
<%
- instance[:states] ||= {}
- instance[:priorities] ||= {}
- instance[:virtual_router_ids] ||= {}
+ instance['states'] ||= {}
+ instance['priorities'] ||= {}
+ instance['virtual_router_ids'] ||= {}
-%>
vrrp_instance <%= name.upcase %> {
- interface <%= instance[:interface] %>
- virtual_router_id <%= instance[:virtual_router_ids][node.name] || node[:keepalived][:instance_defaults][:virtual_router_id] %>
- <% if instance[:nopreempt] -%>
+ interface <%= instance['interface'] %>
+ virtual_router_id <%= instance['virtual_router_ids'][node.name] || node['keepalived']['instance_defaults']['virtual_router_id'] %>
+ <% if instance['nopreempt'] -%>
nopreempt
<% end -%>
- state <%= instance[:states][node.name] || node[:keepalived][:instance_defaults][:state] %>
- priority <%= instance[:priorities][node.name] || node[:keepalived][:instance_defaults][:priority] %>
- <% if instance[:advert_int] -%>
- advert_int <%= instance[:advert_int] %>
+ state <%= instance['states'][node.name] || node['keepalived']['instance_defaults']['state'] %>
+ priority <%= instance['priorities'][node.name] || node['keepalived']['instance_defaults']['priority'] %>
+ <% if instance['advert_int'] -%>
+ advert_int <%= instance['advert_int'] %>
<% end -%>
- <% if instance[:auth_type] -%>
+ <% if instance['auth_type'] -%>
authentication {
- auth_type <%= instance[:auth_type].to_s.upcase %>
- auth_pass <%= instance[:auth_pass] %>
+ auth_type <%= instance['auth_type'].to_s.upcase %>
+ auth_pass <%= instance['auth_pass'] %>
}
<% end -%>
virtual_ipaddress {
- <% Array(instance[:ip_addresses]).each do |address| %>
+ <% Array(instance['ip_addresses']).each do |address| %>
<%= address %>
<% end %>
}
- <% if instance[:track_script] %>
+ <% if instance['track_script'] %>
track_script {
- <%= instance[:track_script] %>
+ <%= instance['track_script'] %>
}
<% end %>
}
Please sign in to comment.
Something went wrong with that request. Please try again.