ansible-role-prosody-master/templates/prosody.inc.j2

199 lines
6.6 KiB
Text
Raw Permalink Normal View History

2022-10-11 09:19:07 +02:00
{#
This is a template fragment (included file) for the Prosody
server's configuration. It handles writing Lua based on the
values of either the global section or a given VirtualHost.
This template is passed the `cfg` Jinja context variable, a
copy of the resolved `prosody_config` variable set by the
Ansible play. To implement configuration options for various
Prosody plugins ("modules"), it further includes a template
located in the `modules/` directory.
Core configuration options are defined directly in this file.
#}
admins = {
{% if cfg.admins is defined %}
{% for jid in cfg.admins %}
"{{ jid }}";
{% endfor %}
{% endif %}
} -- END admins
{% if cfg.data_path is defined %}
data_path = "{{ cfg.data_path }}"
{% endif %}
{% if cfg.plugin_paths is defined %}
plugin_paths = {
{% for path in cfg.plugin_paths %}
"{{ path }}";
{% endfor %}
}
{% endif %}
{% if cfg.modules_enabled is defined %}
modules_enabled = {
{% for module in cfg.modules_enabled %}
"{{ module }}";
{% endfor %}
}
{% endif %}
{% if cfg.modules_disabled is defined %}
modules_disabled = {
{% for module in cfg.modules_disabled %}
"{{ module }}";
{% endfor %}
}
{% endif %}
{% if cfg.authentication is defined %}
authentication = "{{ cfg.authentication }}"
{% endif %}
{% if cfg.default_storage is defined %}
default_storage = "{{ cfg.default_storage }}"
{% endif %}
{% if cfg.storage is defined %}
storage = {% if cfg.storage is mapping %}{
{% for store in cfg.storage %}{% for k, v in store.items() %}
{{ k }} = "{{ v }}";
{% endfor %}{% endfor %}
}{% else %}"{{ cfg.storage }}"{% endif %}
{% endif %}
{% if cfg.log is defined %}
{# TODO: Templatize advanced logging rules: https://prosody.im/doc/advanced_logging #}
log = {% if cfg.log is string %}"{{ cfg.log }}"{% elif cfg.log is mapping %}{
{% if cfg.log.debug is defined %}debug = "{{ cfg.log.debug }}";{% endif %}{{''}}
{% if cfg.log.info is defined %}info = "{{ cfg.log.info }}";{% endif %}{{''}}
{% if cfg.log.warn is defined %}warn = "{{ cfg.log.warn }}";{% endif %}{{''}}
{% if cfg.log.error is defined %}error = "{{ cfg.log.error }}";{% endif %}{{''}}
}
{% endif %}
{% endif %}
{% if cfg.statistics is defined %}
statistics = "{{ cfg.statistics }}"
{% endif %}
{% if cfg.statistics_config is defined %}
statistics_config = {
{% if cfg.statistics_config.statsd_server is defined %}
statsd_server = "{{ cfg.statistics_config.statsd_server }}";
{% endif %}
{% if cfg.statistics_config.statsd_port is defined %}
statsd_port = "{{ cfg.statistics_config.statsd_port }}";
{% endif %}
}
{% endif %}
{% if cfg.statistics_interval is defined %}
statistics_interval = {{ cfg.statistics_interval | int }}
{% endif %}
{% if cfg.conflict_resolve is defined %}
conflict_resolve = "{{ cfg.conflict_resolve }}"
{% endif %}
{% if cfg.ignore_presence_priority is defined %}
ignore_presence_priority = {{ cfg.ignore_presence_priority | bool | lower }}
{% endif %}
{% if cfg.certificates is defined %}
certificates = "{{ cfg.certificates }}"
{% endif %}
{% if cfg.certificate is defined %}
certificate = "{{ cfg.certificate }}"
{% endif %}
{% if cfg.key is defined %}
key = "{{ cfg.key }}"
{% endif %}
{% if cfg.password is defined %}
password = "{{ cfg.password }}"
{% endif %}
{########################################################
## PROSODY CORE MODULES: #
## Include configuration fragments for Prosody modules. #
#########################################################}
{% include "modules/mod_admin_telnet.cfg.lua.j2" %}
{% include "modules/mod_bosh.cfg.lua.j2" %}
{% include "modules/mod_c2s.cfg.lua.j2" %}
{% include "modules/mod_compression.cfg.lua.j2" %}
{% include "modules/mod_csi_simple.cfg.lua.j2" %}
{% include "modules/mod_dialback.cfg.lua.j2" %}
{% include "modules/mod_disco.cfg.lua.j2" %}
{% include "modules/mod_groups.cfg.lua.j2" %}
{% include "modules/mod_http.cfg.lua.j2" %}
{% include "modules/mod_http_errors.cfg.lua.j2" %}
{% include "modules/mod_http_files.cfg.lua.j2" %}
{% include "modules/mod_limits.cfg.lua.j2" %}
{% include "modules/mod_mam.cfg.lua.j2" %}
{% include "modules/mod_motd.cfg.lua.j2" %}
{% include "modules/mod_net_multiplex.cfg.lua.j2" %}
{% include "modules/mod_pep.cfg.lua.j2" %}
{% include "modules/mod_posix.cfg.lua.j2" %}
{% include "modules/mod_proxy65.cfg.lua.j2" ignore missing %}{# TODO: Not yet implemented. #}
{% include "modules/mod_register.cfg.lua.j2" %}
{% include "modules/mod_s2s.cfg.lua.j2" %}
{% include "modules/mod_server_contact_info.cfg.lua.j2" %}
{% include "modules/mod_storage_sql.cfg.lua.j2" %}
{% include "modules/mod_tls.cfg.lua.j2" %}
{% include "modules/mod_version.cfg.lua.j2" %}
{% include "modules/mod_watchregistrations.cfg.lua.j2" %}
{% include "modules/mod_websocket.cfg.lua.j2" %}
{% include "modules/mod_welcome.cfg.lua.j2" %}
{########################################################
## PROSODY COMMUNITY MODULES: #
## Include configuration fragments for Prosody modules. #
#########################################################}
{% include "modules/mod_conversejs.cfg.lua.j2" %}
{% include "modules/mod_default_bookmarks.cfg.lua.j2" %}
{% include "modules/mod_e2e_policy.cfg.lua.j2" %}
{% include "modules/mod_http_authentication.cfg.lua.j2" %}
{% include "modules/mod_http_favicon.cfg.lua.j2" %}
{% include "modules/mod_http_upload.cfg.lua.j2" %}
{% include "modules/mod_lastlog.cfg.lua.j2" %}
{% include "modules/mod_motd_sequential.cfg.lua.j2" %}
{% include "modules/mod_onions.cfg.lua.j2" %}
{% include "modules/mod_reload_modules.cfg.lua.j2" %}
{% include "modules/mod_strict_https.cfg.lua.j2" %}
{% include "modules/mod_support_contact.cfg.lua.j2" %}
{% include "modules/mod_support_room.cfg.lua.j2" %}
{% include "modules/mod_tls_policy.cfg.lua.j2" %}
{% include "modules/mod_xhtmlim.cfg.lua.j2" %}
{########################################################
## PROSODY COMPONENT OPTIONS: #
#########################################################}
{% if cfg.component_ports is defined %}
component_ports = {
{% for port in cfg.component_ports %}
{{ port | int }};
{% endfor %}
}
{% endif %}
{% if cfg.component_interface is defined %}
component_interface = "{{ cfg.component_interface }}"
{% endif %}
{% if cfg.Components is defined %}
{% for component in cfg.Components %}
Component "{{ component.hostname | default('localhost') }}"{% if component.plugin is defined %} "{{ component.plugin }}"{% endif %}{{''}}
{% if component.secret is defined %}
component_secret = "{{ component.secret }}"
{% endif %}
{% if component.options is defined %}
{% for k, v in component.options.items() %}
{{ k }} = {% include "prosody-value.j2" %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}