Move each vhost to its own config file
This commit is contained in:
@@ -6,40 +6,10 @@ log_rotate_count: 1
|
||||
|
||||
log_rate_limit: 100
|
||||
|
||||
hosts:
|
||||
<% @hosts.each do |host| -%>
|
||||
- "<%= host[:name] %>"
|
||||
include_config_file: "/opt/ejabberd/conf/<%= host[:name] %>.yml"
|
||||
<% end -%>
|
||||
|
||||
host_config:
|
||||
<% @hosts.each do |host| -%>
|
||||
"<%= host[:name] %>":
|
||||
sql_type: pgsql
|
||||
sql_server: "localhost"
|
||||
sql_database: "<%= host[:sql_database] %>"
|
||||
sql_username: "ejabberd"
|
||||
sql_password: "<%= @pgsql_password %>"
|
||||
<% if host[:ldap_enabled] -%>
|
||||
auth_method: ldap
|
||||
ldap_servers: ["<%= @ldap_server %>"]
|
||||
ldap_rootdn: "cn=xmpp,ou=<%= host[:name] %>,<%= @ldap_base %>"
|
||||
ldap_password: "<%= host[:ldap_password] %>"
|
||||
ldap_encrypt: <%= @ldap_encryption_type %>
|
||||
ldap_tls_verify: hard # when TLS is enabled, don't proceed if a cert is invalid
|
||||
ldap_base: "ou=<%= host[:name] %>,<%= @ldap_base %>"
|
||||
ldap_filter: "(nsRole=cn=xmpp_role,ou=<%= host[:name] %>,<%= @ldap_base %>)"
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
<% if @hosts.any? { |host| File.exist?("/opt/ejabberd/conf/#{host[:name]}.crt") && File.exist?("/opt/ejabberd/conf/#{host[:name]}.key") } -%>
|
||||
certfiles:
|
||||
<% @hosts.each do |host| -%>
|
||||
<% if File.exist?("/opt/ejabberd/conf/#{host[:name]}.crt") && File.exist?("/opt/ejabberd/conf/#{host[:name]}.key") -%>
|
||||
- "/opt/ejabberd/conf/<%= host[:name] %>.crt"
|
||||
- "/opt/ejabberd/conf/<%= host[:name] %>.key"
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
ca_file: "/opt/ejabberd/conf/cacert.pem"
|
||||
|
||||
define_macro:
|
||||
@@ -248,12 +218,6 @@ modules:
|
||||
mod_s2s_dialback: {}
|
||||
mod_http_api: {}
|
||||
|
||||
append_host_config:
|
||||
<% @hosts.each do |host| -%>
|
||||
"<%= host[:name] %>":
|
||||
<%= host[:append_host_config].chomp %>
|
||||
<% end -%>
|
||||
|
||||
allow_contrib_modules: true
|
||||
|
||||
### Local Variables:
|
||||
|
||||
31
site-cookbooks/kosmos-ejabberd/templates/vhost.yml.erb
Normal file
31
site-cookbooks/kosmos-ejabberd/templates/vhost.yml.erb
Normal file
@@ -0,0 +1,31 @@
|
||||
# Generated by Chef for <%= @host[:name] %>
|
||||
hosts:
|
||||
- "<%= @host[:name] %>"
|
||||
|
||||
<% if File.exist?("/opt/ejabberd/conf/#{@host[:name]}.crt") && File.exist?("/opt/ejabberd/conf/#{@host[:name]}.key") -%>
|
||||
certfiles:
|
||||
- "/opt/ejabberd/conf/<%= @host[:name] %>.crt"
|
||||
- "/opt/ejabberd/conf/<%= @host[:name] %>.key"
|
||||
<% end -%>
|
||||
host_config:
|
||||
"<%= @host[:name] %>":
|
||||
sql_type: pgsql
|
||||
sql_server: "localhost"
|
||||
sql_database: "<%= @host[:sql_database] %>"
|
||||
sql_username: "ejabberd"
|
||||
sql_password: "<%= @pgsql_password %>"
|
||||
<% if @host[:ldap_enabled] -%>
|
||||
auth_method: ldap
|
||||
ldap_servers: ["<%= @ldap_server %>"]
|
||||
ldap_rootdn: "cn=xmpp,ou=<%= @host[:name] %>,<%= @ldap_base %>"
|
||||
ldap_password: "<%= @host[:ldap_password] %>"
|
||||
ldap_encrypt: <%= @ldap_encryption_type %>
|
||||
ldap_tls_verify: hard # when TLS is enabled, don't proceed if a cert is invalid
|
||||
ldap_base: "ou=<%= @host[:name] %>,<%= @ldap_base %>"
|
||||
ldap_filter: "(nsRole=cn=xmpp_role,ou=<%= @host[:name] %>,<%= @ldap_base %>)"
|
||||
<% end -%>
|
||||
|
||||
append_host_config:
|
||||
"<%= @host[:name] %>":
|
||||
<%= @host[:append_host_config].chomp %>
|
||||
|
||||
Reference in New Issue
Block a user