diff options
| author | Matthew Fennell <matthew@fennell.dev> | 2026-01-02 13:24:33 +0000 |
|---|---|---|
| committer | Matthew Fennell <matthew@fennell.dev> | 2026-01-02 13:24:33 +0000 |
| commit | 32bada629f7b2371c91177af834769c9435f3229 (patch) | |
| tree | 86288bd34af299fee7c7d19a0e8cbbc538123eef | |
| parent | c1a5a58d20488272bf0bcc4c4dc2ca11a8ea8fdb (diff) | |
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.
| -rw-r--r-- | files/virtual_host.cfg.lua.j2 | 6 | ||||
| -rw-r--r-- | playbook.yaml | 2 |
2 files changed, 5 insertions, 3 deletions
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 = { diff --git a/playbook.yaml b/playbook.yaml index 0c1fb48..c0fc761 100644 --- a/playbook.yaml +++ b/playbook.yaml @@ -547,3 +547,5 @@ # If virtual_host is "continuous.nonprod.example.org", then ds_subname is # "continuous.nonprod". ds_subname: "{{ virtual_host | regex_replace('.' + domain_with_ds, '') }}" + + is_transport_server: "{{ transports | default([]) | length > 0 }}" |
