Update 3rdparty rabbitmq module
[mirror/dsa-puppet.git] / 3rdparty / modules / rabbitmq / templates / rabbitmq.config.erb
1 % This file managed by Puppet
2 % Template Path: <%= @module_name %>/templates/rabbitmq.config
3 [
4 <%- if @ssl and @ssl_versions -%>
5   {ssl, [{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}]},
6 <%- end -%>
7   {rabbit, [
8 <%- if @heartbeat -%>
9     {heartbeat, <%=@heartbeat%>},
10 <% end -%>
11     {loopback_users, [<%= @loopback_users.map { |u| "<<\"#{u}\">>" }.join(', ') %>]},
12 <% if @auth_backends -%>
13     {auth_backends, [<%= @auth_backends.map { |v| "#{v}" }.join(', ') %>]},
14 <% elsif @ldap_auth -%>
15     {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},
16 <% end -%>
17 <% if @config_cluster -%>
18     {cluster_nodes, {[<%= @cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}},
19     {cluster_partition_handling, <%= @cluster_partition_handling %>},
20 <% end -%>
21     {tcp_listen_options, [
22          <%- unless @config_ranch -%>
23          binary,
24          {packet,        raw},
25          {reuseaddr,     true},
26          <%- end -%>
27          <%- if @tcp_keepalive -%>
28          {keepalive,     true},
29          <%- end -%>
30          <%- if @tcp_backlog -%>
31          {backlog,       <%= @tcp_backlog %>},
32          <%- end -%>
33          <%- if @tcp_sndbuf -%>
34          {sndbuf,       <%= @tcp_sndbuf %>},
35          <%- end -%>
36          <%- if @tcp_recbuf -%>
37          {recbuf,       <%= @tcp_recbuf %>},
38          <%- end -%>
39          {nodelay,       true},
40          {linger,        {true, 0}},
41          {exit_on_close, false}
42     ]},
43 <%- if @collect_statistics_interval -%>
44     {collect_statistics_interval, <%= @collect_statistics_interval %>},
45 <%- end -%>
46 <%- if @ssl_only -%>
47     {tcp_listeners, []},
48 <%- elsif @interface -%>
49     {tcp_listeners, [{"<%= @interface%>", <%= @port %>}]},
50 <%- end -%>
51 <%- if @ssl -%>
52   <%- if @ssl_interface -%>
53     {ssl_listeners, [{"<%= @ssl_interface%>", <%= @ssl_port %>}]},
54   <%- else -%>
55     {ssl_listeners, [<%= @ssl_port %>]},
56   <%- end -%>
57     {ssl_options, [
58                    <%- if @ssl_cacert -%>
59                    {cacertfile,"<%= @ssl_cacert %>"},
60                    <%- end -%>
61                    {certfile,"<%= @ssl_cert %>"},
62                    {keyfile,"<%= @ssl_key %>"},
63                    <%- if @ssl_cert_password -%>
64                    {password, "<%= @ssl_cert_password %>"},
65                    <%- end -%>
66                    <%- if @ssl_depth -%>
67                    {depth,<%= @ssl_depth %>},
68                    <%- end -%>
69                    <%- if @ssl_dhfile -%>
70                    {dhfile, "<%= @ssl_dhfile %>"},
71                    <%- end -%>
72                    {secure_renegotiate,<%= @ssl_secure_renegotiate %>},
73                    {reuse_sessions,<%= @ssl_reuse_sessions %>},
74                    {honor_cipher_order,<%= @ssl_honor_cipher_order %>},
75                    {verify,<%= @ssl_verify %>},
76                    {fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>}
77                    <%- if @ssl_versions -%>
78                    ,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}
79                    <%- end -%>
80                    <%- if @ssl_ciphers and @ssl_ciphers.size > 0 -%>
81                    ,{ciphers,[
82                      <%= @ssl_ciphers.sort.map{|k| "{#{k}}"}.join(",\n                     ") %>
83                    ]}
84                    <%- end -%>
85                   ]},
86 <%- end -%>
87 <% if scope['rabbitmq::config_variables'] -%>
88 <%- scope['rabbitmq::config_variables'].keys.sort.each do |key| -%>
89     {<%= key %>, <%= scope['rabbitmq::config_variables'][key] %>},
90 <%- end -%>
91 <%- end -%>
92     {default_user, <<"<%= @default_user %>">>},
93     {default_pass, <<"<%= @default_pass %>">>}
94   ]}<% if @config_kernel_variables -%>,
95   {kernel, [
96     <%= @config_kernel_variables.sort.map{|k,v| "{#{k}, #{v}}"}.join(",\n    ") %>
97   ]}
98 <%- end -%>
99 <%- if @admin_enable or !@config_management_variables.empty? -%>,
100   {rabbitmq_management, [
101     <%- if !@config_management_variables.empty? -%>
102     <%= @config_management_variables.sort.map{|k,v| "{#{k}, #{v}}"}.join(",\n    ") %>
103     <%- end -%>
104 <%- if @admin_enable -%>
105 <%- if  !@config_management_variables.empty? -%>,<%-end-%>
106     {listener, [
107 <%- if @ssl && @management_ssl -%>
108   <%- if @management_ip_address -%>
109       {ip, "<%= @management_ip_address %>"},
110   <%- end -%>
111       {port, <%= @ssl_management_port %>},
112       {ssl, true},
113       {ssl_opts, [<%- if @ssl_cacert %>
114                   {cacertfile, "<%= @ssl_cacert %>"},
115                   <%- end -%>
116                   {certfile, "<%= @ssl_cert %>"},
117                   {keyfile, "<%= @ssl_key %>"},
118                   {verify,<%= @ssl_management_verify %>},
119                   {fail_if_no_peer_cert,<%= @ssl_management_fail_if_no_peer_cert %>}
120                    <%- if @ssl_versions -%>
121                      ,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}
122                    <%- end -%>
123                   <%- if @ssl_ciphers and @ssl_ciphers.size > 0 -%>
124                   ,{ciphers,[
125                       <%= @ssl_ciphers.sort.map{|k| "{#{k}}"}.join(",\n                      ") %>
126                   ]}
127                   <%- end -%>
128                  ]}
129 <%- else -%>
130   <%- if @management_ip_address -%>
131       {ip, "<%= @management_ip_address %>"},
132   <%- end -%>
133       {port, <%= @management_port %>}
134 <%- end -%>
135     ]}
136 <%- end -%>
137   ]}
138 <%- end -%>
139 <% if @config_stomp -%>,
140 % Configure the Stomp Plugin listening port
141   {rabbitmq_stomp, [
142   <%- if @stomp_ssl_only -%>
143     {tcp_listeners, []}
144   <%- else -%>
145     {tcp_listeners, [<%= @stomp_port %>]}
146   <%- end -%>
147   <%- if @ssl && @ssl_stomp_port -%>
148     ,
149     {ssl_listeners, [<%= @ssl_stomp_port %>]}
150   <%- end -%>
151   ]}
152 <% end -%>
153 <%- if @ldap_auth -%>,
154 % Configure the LDAP authentication plugin
155   {rabbitmq_auth_backend_ldap, [
156     {other_bind, <%= @ldap_other_bind %>},
157     {servers, ["<%= @ldap_server %>"]},
158 <% if @ldap_user_dn_pattern -%>
159     {user_dn_pattern, "<%= @ldap_user_dn_pattern %>"},
160 <%- end -%>
161     {use_ssl, <%= @ldap_use_ssl %>},
162     {port, <%= @ldap_port %>},
163 <% if @ldap_config_variables -%>
164 <%- @ldap_config_variables.keys.sort.each do |key| -%>
165     {<%= key %>, <%= @ldap_config_variables[key] %>},
166 <%- end -%>
167 <%- end -%>
168     {log, <%= @ldap_log %>}
169   ]}
170 <%- end -%>
171 <%- if @config_shovel and not @config_shovel_statics.empty? -%>,
172   {rabbitmq_shovel,
173     [{shovels,[
174       <%= @config_shovel_statics.sort.map{|k,v| "{#{k},[#{v}]}"}.join(",\n      ") %>
175     ]}]}
176 <%- end -%>
177 <%- if @config_additional_variables and not @config_additional_variables.empty? -%>,
178 % Additional config
179 <%- @config_additional_variables.keys.sort.each do |key| -%>
180   {<%= key %>, <%= @config_additional_variables[key] %>}<%- if key != @config_additional_variables.keys.sort.last %>,<% end %>
181 <%- end -%>
182 <%- end -%>
183 ].
184 % EOF