Matrix Docker Ansible eploy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

418 Zeilen
20 KiB

  1. # mautrix-telegram is a Matrix <-> Telegram bridge
  2. # See: https://github.com/tulir/mautrix-telegram
  3. matrix_mautrix_telegram_enabled: true
  4. # See: https://mau.dev/tulir/mautrix-telegram/container_registry
  5. matrix_mautrix_telegram_docker_image: "dock.mau.dev/tulir/mautrix-telegram:v0.6.1"
  6. matrix_mautrix_telegram_docker_image_force_pull: "{{ matrix_mautrix_telegram_docker_image.endswith(':latest') }}"
  7. matrix_mautrix_telegram_base_path: "{{ matrix_base_data_path }}/mautrix-telegram"
  8. matrix_mautrix_telegram_config_path: "{{ matrix_mautrix_telegram_base_path }}/config"
  9. matrix_mautrix_telegram_data_path: "{{ matrix_mautrix_telegram_base_path }}/data"
  10. # Get your own API keys at https://my.telegram.org/apps
  11. matrix_mautrix_telegram_api_id: ''
  12. matrix_mautrix_telegram_api_hash: ''
  13. matrix_mautrix_telegram_bot_token: disabled
  14. # Mautrix telegram public endpoint to log in to telegram
  15. # Use an uuid so it's not easily discoverable.
  16. # Example: /741a0483-ba17-4682-9900-30bd7269f1cc
  17. matrix_mautrix_telegram_public_endpoint: ''
  18. matrix_mautrix_telegram_homeserver_address: 'http://matrix-synapse:8008'
  19. matrix_mautrix_telegram_homeserver_domain: '{{ matrix_domain }}'
  20. matrix_mautrix_telegram_appservice_address: 'http://matrix-mautrix-telegram:8080'
  21. matrix_mautrix_telegram_appservice_public_external: 'https://{{ matrix_server_fqn_matrix }}{{ matrix_mautrix_telegram_public_endpoint }}'
  22. # Controls whether the matrix-telegram container exposes its HTTP port (tcp/8080 in the container).
  23. #
  24. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9006"), or empty string to not expose.
  25. matrix_mautrix_telegram_container_http_host_bind_port: ''
  26. # A list of extra arguments to pass to the container
  27. matrix_mautrix_telegram_container_extra_arguments: []
  28. # List of systemd services that matrix-mautrix-telegram.service depends on.
  29. matrix_mautrix_telegram_systemd_required_services_list: ['docker.service']
  30. # List of systemd services that matrix-mautrix-telegram.service wants
  31. matrix_mautrix_telegram_systemd_wanted_services_list: []
  32. matrix_mautrix_telegram_appservice_token: ''
  33. matrix_mautrix_telegram_homeserver_token: ''
  34. # Default mxisd configuration template which covers the generic use case.
  35. # You can customize it by controlling the various variables inside it.
  36. #
  37. # For a more advanced customization, you can extend the default (see `matrix_mautrix_telegram_configuration_extension_yaml`)
  38. # or completely replace this variable with your own template.
  39. matrix_mautrix_telegram_configuration_yaml: |
  40. #jinja2: lstrip_blocks: "True"
  41. # Homeserver details
  42. homeserver:
  43. # The address that this appservice can use to connect to the homeserver.
  44. address: {{ matrix_mautrix_telegram_homeserver_address }}
  45. # The domain of the homeserver (for MXIDs, etc).
  46. domain: {{ matrix_mautrix_telegram_homeserver_domain }}
  47. # Whether or not to verify the SSL certificate of the homeserver.
  48. # Only applies if address starts with https://
  49. verify_ssl: true
  50. # Application service host/registration related details
  51. # Changing these values requires regeneration of the registration.
  52. appservice:
  53. # The address that the homeserver can use to connect to this appservice.
  54. address: {{ matrix_mautrix_telegram_appservice_address }}
  55. # The hostname and port where this appservice should listen.
  56. hostname: 0.0.0.0
  57. port: 8080
  58. # The maximum body size of appservice API requests (from the homeserver) in mebibytes
  59. # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
  60. max_body_size: 1
  61. # The full URI to the database. SQLite and Postgres are fully supported.
  62. # Other DBMSes supported by SQLAlchemy may or may not work.
  63. # Format examples:
  64. # SQLite: sqlite:///filename.db
  65. # Postgres: postgres://username:password@hostname/dbname
  66. database: sqlite:////data/mautrix-telegram.db
  67. # Public part of web server for out-of-Matrix interaction with the bridge.
  68. # Used for things like login if the user wants to make sure the 2FA password isn't stored in
  69. # the HS database.
  70. public:
  71. # Whether or not the public-facing endpoints should be enabled.
  72. enabled: true
  73. # The prefix to use in the public-facing endpoints.
  74. prefix: {{ matrix_mautrix_telegram_public_endpoint }}
  75. # The base URL where the public-facing endpoints are available. The prefix is not added
  76. # implicitly.
  77. external: {{ matrix_mautrix_telegram_appservice_public_external }}
  78. # Provisioning API part of the web server for automated portal creation and fetching information.
  79. # Used by things like Dimension (https://dimension.t2bot.io/).
  80. provisioning:
  81. # Whether or not the provisioning API should be enabled.
  82. enabled: false
  83. # The prefix to use in the provisioning API endpoints.
  84. prefix: /_matrix/provision/v1
  85. # The shared secret to authorize users of the API.
  86. # Set to "generate" to generate and save a new token.
  87. shared_secret: generate
  88. # The unique ID of this appservice.
  89. id: telegram
  90. # Username of the appservice bot.
  91. bot_username: telegrambot
  92. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  93. # to leave display name/avatar as-is.
  94. bot_displayname: Telegram bridge bot
  95. bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX
  96. # Authentication tokens for AS <-> HS communication.
  97. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  98. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  99. # Bridge config
  100. bridge:
  101. # Localpart template of MXIDs for Telegram users.
  102. # {userid} is replaced with the user ID of the Telegram user.
  103. username_template: "telegram_{userid}"
  104. # Localpart template of room aliases for Telegram portal rooms.
  105. # {groupname} is replaced with the name part of the public channel/group invite link ( https://t.me/{} )
  106. alias_template: "telegram_{groupname}"
  107. # Displayname template for Telegram users.
  108. # {displayname} is replaced with the display name of the Telegram user.
  109. displayname_template: "{displayname} (Telegram)"
  110. # Set the preferred order of user identifiers which to use in the Matrix puppet display name.
  111. # In the (hopefully unlikely) scenario that none of the given keys are found, the numeric user
  112. # ID is used.
  113. #
  114. # If the bridge is working properly, a phone number or an username should always be known, but
  115. # the other one can very well be empty.
  116. #
  117. # Valid keys:
  118. # "full name" (First and/or last name)
  119. # "full name reversed" (Last and/or first name)
  120. # "first name"
  121. # "last name"
  122. # "username"
  123. # "phone number"
  124. displayname_preference:
  125. - full name
  126. - username
  127. - phone number
  128. # Maximum number of members to sync per portal when starting up. Other members will be
  129. # synced when they send messages. The maximum is 10000, after which the Telegram server
  130. # will not send any more members.
  131. # Defaults to no local limit (-> limited to 10000 by server)
  132. max_initial_member_sync: -1
  133. # Whether or not to sync the member list in channels.
  134. # If no channel admins have logged into the bridge, the bridge won't be able to sync the member
  135. # list regardless of this setting.
  136. sync_channel_members: true
  137. # Whether or not to skip deleted members when syncing members.
  138. skip_deleted_members: true
  139. # Whether or not to automatically synchronize contacts and chats of Matrix users logged into
  140. # their Telegram account at startup.
  141. startup_sync: true
  142. # Number of most recently active dialogs to check when syncing chats.
  143. # Dialogs include groups and private chats, but only groups are synced.
  144. # Set to 0 to remove limit.
  145. sync_dialog_limit: 30
  146. # The maximum number of simultaneous Telegram deletions to handle.
  147. # A large number of simultaneous redactions could put strain on your homeserver.
  148. max_telegram_delete: 10
  149. # Whether or not to automatically sync the Matrix room state (mostly unpuppeted displaynames)
  150. # at startup and when creating a bridge.
  151. sync_matrix_state: true
  152. # Allow logging in within Matrix. If false, the only way to log in is using the out-of-Matrix
  153. # login website (see appservice.public config section)
  154. allow_matrix_login: true
  155. # Whether or not to bridge plaintext highlights.
  156. # Only enable this if your displayname_template has some static part that the bridge can use to
  157. # reliably identify what is a plaintext highlight.
  158. plaintext_highlights: false
  159. # Show message editing as a reply to the original message.
  160. # If this is false, message edits are not shown at all, as Matrix does not support editing yet.
  161. edits_as_replies: true
  162. # Highlight changed/added parts in edits. Requires lxml.
  163. highlight_edits: false
  164. # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
  165. public_portals: true
  166. # Whether or not to fetch and handle Telegram updates at startup from the time the bridge was down.
  167. # Currently only works for private chats and normal groups.
  168. catch_up: false
  169. # Whether or not to use /sync to get presence, read receipts and typing notifications when using
  170. # your own Matrix account as the Matrix puppet for your Telegram account.
  171. sync_with_custom_puppets: true
  172. # Set to false to disable link previews in messages sent to Telegram.
  173. telegram_link_preview: true
  174. # Use inline images instead of a separate message for the caption.
  175. # N.B. Inline images are not supported on all clients (e.g. Riot iOS).
  176. inline_images: false
  177. # Maximum size of image in megabytes before sending to Telegram as a document.
  178. image_as_file_size: 10
  179. # Maximum size of Telegram documents in megabytes to bridge.
  180. max_document_size: 100
  181. # Whether to bridge Telegram bot messages as m.notices or m.texts.
  182. bot_messages_as_notices: true
  183. bridge_notices:
  184. # Whether or not Matrix bot messages (type m.notice) should be bridged.
  185. default: false
  186. # List of user IDs for whom the previous flag is flipped.
  187. # e.g. if bridge_notices.default is false, notices from other users will not be bridged, but
  188. # notices from users listed here will be bridged.
  189. exceptions: []
  190. # Some config options related to Telegram message deduplication.
  191. # The default values are usually fine, but some debug messages/warnings might recommend you
  192. # change these.
  193. deduplication:
  194. # Whether or not to check the database if the message about to be sent is a duplicate.
  195. pre_db_check: false
  196. # The number of latest events to keep when checking for duplicates.
  197. # You might need to increase this on high-traffic bridge instances.
  198. cache_queue_length: 20
  199. # The formats to use when sending messages to Telegram via the relay bot.
  200. #
  201. # Telegram doesn't have built-in emotes, so the m.emote format is also used for non-relaybot users.
  202. #
  203. # Available variables:
  204. # $sender_displayname - The display name of the sender (e.g. Example User)
  205. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  206. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  207. # $message - The message content as HTML
  208. message_formats:
  209. m.text: "<b>$sender_displayname</b>: $message"
  210. m.emote: "* <b>$sender_displayname</b> $message"
  211. m.file: "<b>$sender_displayname</b> sent a file: $message"
  212. m.image: "<b>$sender_displayname</b> sent an image: $message"
  213. m.audio: "<b>$sender_displayname</b> sent an audio file: $message"
  214. m.video: "<b>$sender_displayname</b> sent a video: $message"
  215. m.location: "<b>$sender_displayname</b> sent a location: $message"
  216. # The formats to use when sending state events to Telegram via the relay bot.
  217. #
  218. # Variables from `message_formats` that have the `sender_` prefix are available without the prefix.
  219. # In name_change events, `$prev_displayname` is the previous displayname.
  220. #
  221. # Set format to an empty string to disable the messages for that event.
  222. state_event_formats:
  223. join: "<b>$displayname</b> joined the room."
  224. leave: "<b>$displayname</b> left the room."
  225. name_change: "<b>$prev_displayname</b> changed their name to <b>$displayname</b>"
  226. # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and
  227. # `filter-mode` management commands.
  228. #
  229. # Filters do not affect direct chats.
  230. # An empty blacklist will essentially disable the filter.
  231. filter:
  232. # Filter mode to use. Either "blacklist" or "whitelist".
  233. # If the mode is "blacklist", the listed chats will never be bridged.
  234. # If the mode is "whitelist", only the listed chats can be bridged.
  235. mode: blacklist
  236. # The list of group/channel IDs to filter.
  237. list: []
  238. # The prefix for commands. Only required in non-management rooms.
  239. command_prefix: "!tg"
  240. # Permissions for using the bridge.
  241. # Permitted values:
  242. # relaybot - Only use the bridge via the relaybot, no access to commands.
  243. # user - Relaybot level + access to commands to create bridges.
  244. # puppeting - User level + logging in with a Telegram account.
  245. # full - Full access to use the bridge, i.e. previous levels + Matrix login.
  246. # admin - Full access to use the bridge and some extra administration commands.
  247. # Permitted keys:
  248. # * - All Matrix users
  249. # domain - All users on that homeserver
  250. # mxid - Specific user
  251. permissions:
  252. '{{ matrix_mautrix_telegram_homeserver_domain }}': full
  253. # Options related to the message relay Telegram bot.
  254. relaybot:
  255. # Whether or not to allow creating portals from Telegram.
  256. authless_portals: true
  257. # Whether or not to allow Telegram group admins to use the bot commands.
  258. whitelist_group_admins: true
  259. # Whether or not to ignore incoming events sent by the relay bot.
  260. ignore_own_incoming_events: true
  261. # List of usernames/user IDs who are also allowed to use the bot commands.
  262. whitelist: []
  263. # Telegram config
  264. telegram:
  265. # Get your own API keys at https://my.telegram.org/apps
  266. api_id: {{ matrix_mautrix_telegram_api_id }}
  267. api_hash: {{ matrix_mautrix_telegram_api_hash }}
  268. # (Optional) Create your own bot at https://t.me/BotFather
  269. bot_token: {{ matrix_mautrix_telegram_bot_token }}
  270. # Telethon connection options.
  271. connection:
  272. # The timeout in seconds to be used when connecting.
  273. timeout: 120
  274. # How many times the reconnection should retry, either on the initial connection or when
  275. # Telegram disconnects us. May be set to a negative or null value for infinite retries, but
  276. # this is not recommended, since the program can get stuck in an infinite loop.
  277. retries: 5
  278. # The delay in seconds to sleep between automatic reconnections.
  279. retry_delay: 1
  280. # The threshold below which the library should automatically sleep on flood wait errors
  281. # (inclusive). For instance, if a FloodWaitError for 17s occurs and flood_sleep_threshold
  282. # is 20s, the library will sleep automatically. If the error was for 21s, it would raise
  283. # the error instead. Values larger than a day (86400) will be changed to a day.
  284. flood_sleep_threshold: 60
  285. # How many times a request should be retried. Request are retried when Telegram is having
  286. # internal issues, when there is a FloodWaitError less than flood_sleep_threshold, or when
  287. # there's a migrate error. May take a negative or null value for infinite retries, but this
  288. # is not recommended, since some requests can always trigger a call fail (such as searching
  289. # for messages).
  290. request_retries: 5
  291. # Device info sent to Telegram.
  292. device_info:
  293. # "auto" = OS name+version.
  294. device_model: auto
  295. # "auto" = Telethon version.
  296. system_version: auto
  297. # "auto" = mautrix-telegram version.
  298. app_version: auto
  299. lang_code: en
  300. system_lang_code: en
  301. # Custom server to connect to.
  302. server:
  303. # Set to true to use these server settings. If false, will automatically
  304. # use production server assigned by Telegram. Set to false in production.
  305. enabled: false
  306. # The DC ID to connect to.
  307. dc: 2
  308. # The IP to connect to.
  309. ip: 149.154.167.40
  310. # The port to connect to. 443 may not work, 80 is better and both are equally secure.
  311. port: 80
  312. # Telethon proxy configuration.
  313. # You must install PySocks from pip for proxies to work.
  314. proxy:
  315. # Allowed types: disabled, socks4, socks5, http
  316. type: disabled
  317. # Proxy IP address and port.
  318. address: 127.0.0.1
  319. port: 1080
  320. # Whether or not to perform DNS resolving remotely.
  321. rdns: true
  322. # Proxy authentication (optional).
  323. username: ""
  324. password: ""
  325. # Python logging configuration.
  326. #
  327. # See section 16.7.2 of the Python documentation for more info:
  328. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  329. logging:
  330. version: 1
  331. formatters:
  332. precise:
  333. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  334. handlers:
  335. console:
  336. class: logging.StreamHandler
  337. formatter: precise
  338. loggers:
  339. mau:
  340. level: DEBUG
  341. telethon:
  342. level: DEBUG
  343. aiohttp:
  344. level: INFO
  345. root:
  346. level: DEBUG
  347. handlers: [console]
  348. matrix_mautrix_telegram_configuration_extension_yaml: |
  349. # Your custom YAML configuration goes here.
  350. # This configuration extends the default starting configuration (`matrix_mautrix_telegram_configuration_yaml`).
  351. #
  352. # You can override individual variables from the default configuration, or introduce new ones.
  353. #
  354. # If you need something more special, you can take full control by
  355. # completely redefining `matrix_mautrix_telegram_configuration_yaml`.
  356. matrix_mautrix_telegram_configuration_extension: "{{ matrix_mautrix_telegram_configuration_extension_yaml|from_yaml if matrix_mautrix_telegram_configuration_extension_yaml|from_yaml is mapping else {} }}"
  357. # Holds the final configuration (a combination of the default and its extension).
  358. # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_telegram_configuration_yaml`.
  359. matrix_mautrix_telegram_configuration: "{{ matrix_mautrix_telegram_configuration_yaml|from_yaml|combine(matrix_mautrix_telegram_configuration_extension, recursive=True) }}"
  360. matrix_mautrix_telegram_registration_yaml: |
  361. id: telegram
  362. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  363. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  364. namespaces:
  365. users:
  366. - exclusive: true
  367. regex: '^@telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$'
  368. aliases:
  369. - exclusive: true
  370. regex: '^#telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$'
  371. url: {{ matrix_mautrix_telegram_appservice_address }}
  372. sender_localpart: telegrambot
  373. rate_limited: false
  374. matrix_mautrix_telegram_registration: "{{ matrix_mautrix_telegram_registration_yaml|from_yaml }}"