initial commit

This commit is contained in:
pyrschtjag committed 2026-10-02 21:34:01 +04:00
commit 13eace9ce9
219 files changed
+6918

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
- name: restart prosody
ansible.builtin.systemd_service:
name: prosody
state: restarted
enabled: true
+66
View File
@@ -0,0 +1,66 @@
---
- name: install prosody
ansible.builtin.apt:
name:
- prosody
- lua-dbi-postgresql
- prosody-modules
state: present
update_cache: yes
notify:
- restart prosody
- name: fetch wan ip
ansible.builtin.shell: ssh -o StrictHostKeyChecking=no root@{{ hostvars['router'].ip }} "ip -4 addr show eth1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'"
delegate_to: localhost
register: router_wan_ip
changed_when: false
vars:
ansible_connection: local
- name: ensure prosody data directory is a mountpoint
ansible.builtin.command: mountpoint -q /var/lib/prosody
register: vw_mountpoint
failed_when: false
changed_when: false
- name: remove default prosody data directory
ansible.builtin.file:
path: /var/lib/prosody
state: absent
when: vw_mountpoint.rc != 0
- name: ensure prosody data source directory exists
ansible.builtin.file:
path: /mnt/prosody/data
state: directory
owner: prosody
group: prosody
mode: "0755"
- name: bind mount prosody data directory
ansible.posix.mount:
path: /var/lib/prosody
src: /mnt/prosody/data
fstype: none
opts: bind
state: mounted
notify: restart prosody
- name: set prosody data directory ownership
ansible.builtin.file:
path: /mnt/prosody/data
owner: prosody
group: prosody
recurse: true
- name: deploy prosody config
ansible.builtin.template:
src: "{{ inventory_hostname }}/prosody.cfg.lua.j2"
dest: "/etc/prosody/prosody.cfg.lua"
owner: prosody
group: root
mode: '0640'
vars:
wan_ip: "{{ router_wan_ip.stdout }}"
notify: restart prosody
@@ -0,0 +1,137 @@
pidfile = "/run/prosody/prosody.pid"
plugin_paths = { "/etc/prosody/prosody-modules" }
admins = { "pyrschtjag@talk.oyacoi.ru" }
http_check_client_ip = false
interfaces = { "*" }
http_interfaces = { "*" }
https_interfaces = { }
trusted_proxies = { "127.0.0.1", "{{ hostvars['haproxy'].ip }}" }
external_addresses = { "{{ wan_ip }}" }
consider_websocket_secure = true
certificates = "certs"
c2s_direct_tls_ports = { 5223 }
s2s_direct_tls_ports = { 5270 }
c2s_require_encryption = true
s2s_require_encryption = true
s2s_secure_auth = true
tls_profile = "intermediate"
contact_info = {
abuse = { "xmpp:pyrschtjag@talk.oyacoi.ru" };
admin = { "xmpp:pyrschtjag@talk.oyacoi.ru" };
}
modules_enabled = {
-- Core
"disco";
"roster";
"saslauth";
"tls";
"dialback";
"s2s_auth_certs";
"limits";
"mam";
"smacks";
"carbons";
"pep";
"private";
"s2s_bidi";
"vcard4";
"vcard_legacy";
"bookmarks";
"blocklist";
"account_activity";
"pubsub";
"csi_simple";
"cloud_notify";
"cloud_notify_extensions";
"throttle_presence";
"register";
"ping";
"uptime";
"version";
"time";
"server_contact_info";
"admin_adhoc";
"admin_shell";
"bosh";
"websocket";
"http";
"turn_external";
"external_services";
"sasl2";
"sasl2_bind2";
}
storage = "sql"
sql = {
driver = "PostgreSQL";
database = "prosody";
username = "prosody_user";
password = "{{ database_password }}";
host = "{{ hostvars['pgsql'].ip }}";
}
archive_expires_after = "1y"
max_archive_query_results = 20
network_settings = {
read_timeout = 840;
}
smacks_max_unacked_stanzas = 500
smacks_hibernation_time = 300
limits = {
c2s = { rate = "500kb/s" };
s2sin = { rate = "50kb/s" };
}
authentication = "internal_hashed"
allow_registration = false
turn_external_host = "turn.oyacoi.ru"
turn_external_secret = "{{ hostvars['coturn']['turn_external_secret'] }}"
external_services = {
{ type = "stun", transport = "udp", host = "turn.oyacoi.ru", port = 3478 },
{ type = "stun", transport = "tcp", host = "turn.oyacoi.ru", port = 3478 },
{ type = "turn", transport = "udp", host = "turn.oyacoi.ru", port = 3478 },
{ type = "turn", transport = "tcp", host = "turn.oyacoi.ru", port = 3478 },
{ type = "stuns", transport = "tcp", host = "turn.oyacoi.ru", port = 5349 },
{ type = "turns", transport = "tcp", host = "turn.oyacoi.ru", port = 5349 }
}
log = {
info = "/var/log/prosody/prosody.log";
error = "/var/log/prosody/prosody.err";
{ levels = { "error" }; to = "syslog"; };
}
VirtualHost "talk.oyacoi.ru"
disco_items = {
{ "conference.oyacoi.ru", "Chatrooms" };
{ "upload.oyacoi.ru", "File Storage" };
{ "proxy.oyacoi.ru", "File Transfer Relay" };
{ "pubsub.oyacoi.ru", "PubSub Service" };
}
ssl = {
key = "/etc/prosody/certs/talk.oyacoi.ru.key";
certificate = "/etc/prosody/certs/talk.oyacoi.ru.crt";
}
Component "conference.oyacoi.ru" "muc"
modules_enabled = { "muc_mam", "muc_moderation" }
restrict_room_creation = "local"
muc_log_by_default = true
muc_log_expires_after = "1w"
ssl = {
key = "/etc/prosody/certs/conference.oyacoi.ru.key";
certificate = "/etc/prosody/certs/conference.oyacoi.ru.crt";
}
Component "upload.oyacoi.ru" "http_file_share"
http_path = { file_share = "/" }
http_external_url = "https://upload.oyacoi.ru/"
http_file_share_access = { "talk.oyacoi.ru" }
http_file_share_size_limit = 1024 * 1024 * 1024
http_file_share_expires_after = "31 days"
Component "proxy.oyacoi.ru" "proxy65"
proxy65_address = "proxy.oyacoi.ru"
proxy65_acl = { "talk.oyacoi.ru" }
ssl = {
key = "/etc/prosody/certs/proxy.oyacoi.ru.key";
certificate = "/etc/prosody/certs/proxy.oyacoi.ru.crt";
}
Component "pubsub.oyacoi.ru" "pubsub"
public_subscriptions = true
ssl = {
key = "/etc/prosody/certs/pubsub.oyacoi.ru.key";
certificate = "/etc/prosody/certs/pubsub.oyacoi.ru.crt";
}