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