From 32bada629f7b2371c91177af834769c9435f3229 Mon Sep 17 00:00:00 2001 From: Matthew Fennell Date: Fri, 2 Jan 2026 13:24:33 +0000 Subject: Derive is_transport_server from transport count I have two different kinds of servers - transport servers (which connect to legacy networks and have s2s disabled) and non-transport servers (which are XMPP-only and have s2s enabled). I previously had an is_transport_server boolean defined for each host in the inventory - however, this is duplicated information that can be derived from the length of the transports value (which lists the legacy networks to transport to). Transport servers have a non-empty transports list, while non-transport servers do not define the variable at all. So, handle this case in the playbook by deriving an empty list if the value is not present. --- files/virtual_host.cfg.lua.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'files/virtual_host.cfg.lua.j2') diff --git a/files/virtual_host.cfg.lua.j2 b/files/virtual_host.cfg.lua.j2 index c5700c2..203d1a8 100644 --- a/files/virtual_host.cfg.lua.j2 +++ b/files/virtual_host.cfg.lua.j2 @@ -45,7 +45,7 @@ site_name = "{{ virtual_host }}" {% endif %} privileged_entities = { -{% for transport in transports %} +{% for transport in transports | default([]) %} ["{{ transport.subdomain }}.{{ virtual_host }}"] = { roster = "both"; message = "outgoing"; @@ -63,7 +63,7 @@ http_file_share_global_quota = 5 * 1024 * 1024 * 1024 {% if is_transport_server %} http_file_share_access = { -{% for transport in transports %} +{% for transport in transports | default([]) %} "{{ transport.subdomain }}.{{ virtual_host }}"; {% endfor %} } @@ -98,7 +98,7 @@ muc_room_default_public_jids = true muc_rtbl_jid = "xmppbl.org" {% endif %} -{% for transport in transports %} +{% for transport in transports | default([]) %} Component "{{ transport.subdomain }}.{{ virtual_host }}" component_secret = "{{ transport.secret }}" modules_enabled = { -- cgit v1.2.3