Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

428 lines
22 KiB

  1. # SPDX-FileCopyrightText: 2024 MDAD Team and contributors
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. # Matrix Appservice IRC is a Matrix <-> IRC bridge
  6. # Project source code URL: https://github.com/matrix-org/matrix-appservice-irc
  7. matrix_appservice_irc_enabled: true
  8. matrix_appservice_irc_container_image_self_build: false
  9. matrix_appservice_irc_docker_repo: "https://github.com/matrix-org/matrix-appservice-irc.git"
  10. matrix_appservice_irc_docker_repo_version: "{{ 'master' if matrix_appservice_irc_version == 'latest' else matrix_appservice_irc_version }}"
  11. matrix_appservice_irc_docker_src_files_path: "{{ matrix_base_data_path }}/appservice-irc/docker-src"
  12. # matrix_appservice_irc_version used to contain the full Docker image tag (e.g. `release-X.X.X`).
  13. # It's a bare version number now. We try to somewhat retain compatibility below.
  14. # renovate: datasource=docker depName=docker.io/matrixdotorg/matrix-appservice-irc
  15. matrix_appservice_irc_version: 1.0.1
  16. matrix_appservice_irc_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-irc:{{ matrix_appservice_irc_docker_image_tag }}"
  17. matrix_appservice_irc_docker_image_tag: "{{ 'latest' if matrix_appservice_irc_version == 'latest' else ('release-' + matrix_appservice_irc_version) }}"
  18. matrix_appservice_irc_docker_image_force_pull: "{{ matrix_appservice_irc_docker_image.endswith(':latest') }}"
  19. matrix_appservice_irc_docker_image_name_prefix: "{{ 'localhost/' if matrix_appservice_irc_container_image_self_build else matrix_container_global_registry_prefix }}"
  20. matrix_appservice_irc_base_path: "{{ matrix_base_data_path }}/appservice-irc"
  21. matrix_appservice_irc_config_path: "{{ matrix_appservice_irc_base_path }}/config"
  22. matrix_appservice_irc_data_path: "{{ matrix_appservice_irc_base_path }}/data"
  23. matrix_appservice_irc_homeserver_url: ""
  24. matrix_appservice_irc_homeserver_media_url: '{{ matrix_homeserver_url }}'
  25. matrix_appservice_irc_homeserver_domain: '{{ matrix_domain }}'
  26. matrix_appservice_irc_homeserver_enablePresence: true # noqa var-naming
  27. matrix_appservice_irc_appservice_address: 'http://matrix-appservice-irc:9999'
  28. matrix_appservice_irc_database_engine: nedb
  29. matrix_appservice_irc_database_username: matrix_appservice_irc
  30. matrix_appservice_irc_database_password: 'some-password'
  31. matrix_appservice_irc_database_hostname: ''
  32. matrix_appservice_irc_database_port: 5432
  33. matrix_appservice_irc_database_name: matrix_appservice_irc
  34. matrix_appservice_irc_database_sslmode: disable
  35. # The name of the container network to use when importing a NeDB database into Postgres.
  36. # For Postgres not working in a container, this can be left empty.
  37. matrix_appservice_irc_database_container_network: ''
  38. # This is just the Postgres connection string, if Postgres is used.
  39. # Naming clashes with `matrix_appservice_irc_database_connectionString` somewhat.
  40. matrix_appservice_irc_database_connection_string: 'postgresql://{{ matrix_appservice_irc_database_username }}:{{ matrix_appservice_irc_database_password }}@{{ matrix_appservice_irc_database_hostname }}:{{ matrix_appservice_irc_database_port }}/{{ matrix_appservice_irc_database_name }}?sslmode={{ matrix_appservice_irc_database_sslmode }}'
  41. # This is what actually goes into `database.connectionString` for the bridge.
  42. matrix_appservice_irc_database_connectionString: |- # noqa var-naming
  43. {{
  44. {
  45. 'nedb': 'nedb:///data',
  46. 'postgres': matrix_appservice_irc_database_connection_string,
  47. }[matrix_appservice_irc_database_engine]
  48. }}
  49. matrix_appservice_irc_ircService_servers: [] # noqa var-naming
  50. # Example of `matrix_appservice_irc_ircService_servers` with one server (and all its options):
  51. #
  52. # matrix_appservice_irc_ircService_servers:
  53. # # The address of the server to connect to.
  54. # irc.example.com:
  55. # # A human-readable short name. This is used to label IRC status rooms
  56. # # where Matrix users control their connections.
  57. # # E.g. 'ExampleNet IRC Bridge status'.
  58. # # It is also used in the Third Party Lookup API as the instance `desc`
  59. # # property, where each server is an instance.
  60. # name: "ExampleNet"
  61. # additionalAddresses: [ "irc2.example.com" ]
  62. # #
  63. # # [DEPRECATED] Use `name`, above, instead.
  64. # # A human-readable description string
  65. # # description: "Example.com IRC network"
  66. # # An ID for uniquely identifying this server amongst other servers being bridged.
  67. # # networkId: "example"
  68. # # URL to an icon used as the network icon whenever this network appear in
  69. # # a network list. (Like in the Riot room directory, for instance.)
  70. # # icon: https://example.com/images/hash.png
  71. # # The port to connect to. Optional.
  72. # port: 6697
  73. # # Whether to use SSL or not. Default: false.
  74. # ssl: true
  75. # # Whether or not IRC server is using a self-signed cert or not providing CA Chain
  76. # sslselfsign: false
  77. # # Should the connection attempt to identify via SASL (if a server or user password is given)
  78. # # If false, this will use PASS instead. If SASL fails, we do not fallback to PASS.
  79. # sasl: false
  80. # # Whether to allow expired certs when connecting to the IRC server.
  81. # # Usually this should be off. Default: false.
  82. # allowExpiredCerts: false
  83. # # A specific CA to trust instead of the default CAs. Optional.
  84. # #ca: |
  85. # # -----BEGIN CERTIFICATE-----
  86. # # …
  87. # # -----END CERTIFICATE-----
  88. # #
  89. # # The connection password to send for all clients as a PASS (or SASL, if enabled above) command. Optional.
  90. # # password: 'pa$$w0rd'
  91. # #
  92. # # Whether or not to send connection/error notices to real Matrix users. Default: true.
  93. # sendConnectionMessages: true
  94. # quitDebounce:
  95. # # Whether parts due to net-splits are debounced for delayMs, to allow
  96. # # time for the netsplit to resolve itself. A netsplit is detected as being
  97. # # a QUIT rate higher than quitsPerSecond. Default: false.
  98. # enabled: false
  99. # # The maximum number of quits per second acceptable above which a netsplit is
  100. # # considered ongoing. Default: 5.
  101. # quitsPerSecond: 5
  102. # # The time window in which to wait before bridging a QUIT to Matrix that occurred during
  103. # # a netsplit. Debouncing is jittered randomly between delayMinMs and delayMaxMs so that the HS
  104. # # is not sent many requests to leave rooms all at once if a netsplit occurs and many
  105. # # people to not rejoin.
  106. # # If the user with the same IRC nick as the one who sent the quit rejoins a channel
  107. # # they are considered back online and the quit is not bridged, so long as the rejoin
  108. # # occurs before the randomly-jittered timeout is not reached.
  109. # # Default: 3600000, = 1h
  110. # delayMinMs: 3600000 # 1h
  111. # # Default: 7200000, = 2h
  112. # delayMaxMs: 7200000 # 2h
  113. # # A map for conversion of IRC user modes to Matrix power levels. This enables bridging
  114. # # of IRC ops to Matrix power levels only, it does not enable the reverse. If a user has
  115. # # been given multiple modes, the one that maps to the highest power level will be used.
  116. # modePowerMap:
  117. # o: 50
  118. # botConfig:
  119. # # Enable the presence of the bot in IRC channels. The bot serves as the entity
  120. # # which maps from IRC -> Matrix. You can disable the bot entirely which
  121. # # means IRC -> Matrix chat will be shared by active "M-Nick" connections
  122. # # in the room. If there are no users in the room (or if there are users
  123. # # but their connections are not on IRC) then nothing will be bridged to
  124. # # Matrix. If you're concerned about the bot being treated as a "logger"
  125. # # entity, then you may want to disable the bot. If you want IRC->Matrix
  126. # # but don't want to have TCP connections to IRC unless a Matrix user speaks
  127. # # (because your client connection limit is low), then you may want to keep
  128. # # the bot enabled. Default: true.
  129. # # NB: If the bot is disabled, you SHOULD have matrix-to-IRC syncing turned
  130. # # on, else there will be no users and no bot in a channel (meaning no
  131. # # messages to Matrix!) until a Matrix user speaks which makes a client
  132. # # join the target IRC channel.
  133. # # NBB: The bridge bot IRC client will still join the target IRC network so
  134. # # it can service bridge-specific queries from the IRC-side e.g. so
  135. # # real IRC clients have a way to change their Matrix display name.
  136. # # See https://github.com/matrix-org/matrix-appservice-irc/issues/55
  137. # enabled: true
  138. # # The nickname to give the AS bot.
  139. # nick: "MatrixBot"
  140. # # The password to give to NickServ or IRC Server for this nick. Optional.
  141. # # password: "helloworld"
  142. # #
  143. # # Join channels even if there are no Matrix users on the other side of
  144. # # the bridge. Set to false to prevent the bot from joining channels which have no
  145. # # real Matrix users in them, even if there is a mapping for the channel.
  146. # # Default: true
  147. # joinChannelsIfNoUsers: true
  148. # # Configuration for PMs / private 1:1 communications between users.
  149. # privateMessages:
  150. # # Enable the ability for PMs to be sent to/from IRC/Matrix.
  151. # # Default: true.
  152. # enabled: true
  153. # # Prevent Matrix users from sending PMs to the following IRC nicks.
  154. # # Optional. Default: [].
  155. # # exclude: ["Alice", "Bob"] # NOT YET IMPLEMENTED
  156. # # Should created Matrix PM rooms be federated? If false, only users on the
  157. # # HS attached to this AS will be able to interact with this room.
  158. # # Optional. Default: true.
  159. # federate: true
  160. # # Configuration for mappings not explicitly listed in the 'mappings'
  161. # # section.
  162. # dynamicChannels:
  163. # # Enable the ability for Matrix users to join *any* channel on this IRC
  164. # # network.
  165. # # Default: false.
  166. # enabled: true
  167. # # Should the AS create a room alias for the new Matrix room? The form of
  168. # # the alias can be modified via 'aliasTemplate'. Default: true.
  169. # createAlias: true
  170. # # Should the AS publish the new Matrix room to the public room list so
  171. # # anyone can see it? Default: true.
  172. # published: true
  173. # # What should the join_rule be for the new Matrix room? If 'public',
  174. # # anyone can join the room. If 'invite', only users with an invite can
  175. # # join the room. Note that if an IRC channel has +k or +i set on it,
  176. # # join_rules will be set to 'invite' until these modes are removed.
  177. # # Default: "public".
  178. # joinRule: public
  179. # # This will set the m.room.related_groups state event in newly created rooms
  180. # # with the given groupId. This means flares will show up on IRC users in those rooms.
  181. # # This should be set to the same thing as namespaces.users.group_id in irc_registration.
  182. # # This does not alter existing rooms.
  183. # # Leaving this option empty will not set the event.
  184. # groupId: +myircnetwork:localhost
  185. # # Should created Matrix rooms be federated? If false, only users on the
  186. # # HS attached to this AS will be able to interact with this room.
  187. # # Default: true.
  188. # federate: true
  189. # # The room alias template to apply when creating new aliases. This only
  190. # # applies if createAlias is 'true'. The following variables are exposed:
  191. # # $SERVER => The IRC server address (e.g. "irc.example.com")
  192. # # $CHANNEL => The IRC channel (e.g. "#python")
  193. # # This MUST have $CHANNEL somewhere in it.
  194. # # Default: '#irc_$SERVER_$CHANNEL'
  195. # aliasTemplate: "#irc_$CHANNEL"
  196. # # A list of user IDs which the AS bot will send invites to in response
  197. # # to a !join. Only applies if joinRule is 'invite'. Default: []
  198. # # whitelist:
  199. # # - "@foo:example.com"
  200. # # - "@bar:example.com"
  201. # #
  202. # # Prevent the given list of channels from being mapped under any
  203. # # circumstances.
  204. # # exclude: ["#foo", "#bar"]
  205. # # Configuration for controlling how Matrix and IRC membership lists are
  206. # # synced.
  207. # membershipLists:
  208. # # Enable the syncing of membership lists between IRC and Matrix. This
  209. # # can have a significant effect on performance on startup as the lists are
  210. # # synced. This must be enabled for anything else in this section to take
  211. # # effect. Default: false.
  212. # enabled: false
  213. # # Syncing membership lists at startup can result in hundreds of members to
  214. # # process all at once. This timer drip feeds membership entries at the
  215. # # specified rate. Default: 10000. (10s)
  216. # floodDelayMs: 10000
  217. # global:
  218. # ircToMatrix:
  219. # # Get a snapshot of all real IRC users on a channel (via NAMES) and
  220. # # join their virtual Matrix clients to the room.
  221. # initial: false
  222. # # Make virtual Matrix clients join and leave rooms as their real IRC
  223. # # counterparts join/part channels. Default: false.
  224. # incremental: false
  225. # matrixToIrc:
  226. # # Get a snapshot of all real Matrix users in the room and join all of
  227. # # them to the mapped IRC channel on startup. Default: false.
  228. # initial: false
  229. # # Make virtual IRC clients join and leave channels as their real Matrix
  230. # # counterparts join/leave rooms. Make sure your 'maxClients' value is
  231. # # high enough! Default: false.
  232. # incremental: false
  233. # # Apply specific rules to Matrix rooms. Only matrix-to-IRC takes effect.
  234. # rooms:
  235. # - room: "!qporfwt:localhost"
  236. # matrixToIrc:
  237. # initial: false
  238. # incremental: false
  239. # # Apply specific rules to IRC channels. Only IRC-to-matrix takes effect.
  240. # channels:
  241. # - channel: "#foo"
  242. # ircToMatrix:
  243. # initial: false
  244. # incremental: false
  245. # mappings:
  246. # # 1:many mappings from IRC channels to room IDs on this IRC server.
  247. # # The Matrix room must already exist. Your Matrix client should expose
  248. # # the room ID in a "settings" page for the room.
  249. # "#thepub":
  250. # roomIds: ["!qporfwt:localhost"]
  251. # # Channel key/password to use. Optional. If provided, Matrix users do
  252. # # not need to know the channel key in order to join the channel.
  253. # # key: "secret"
  254. # # Configuration for virtual Matrix users. The following variables are
  255. # # exposed:
  256. # # $NICK => The IRC nick
  257. # # $SERVER => The IRC server address (e.g. "irc.example.com")
  258. # matrixClients:
  259. # # The user ID template to use when creating virtual Matrix users. This
  260. # # MUST have $NICK somewhere in it.
  261. # # Optional. Default: "@$SERVER_$NICK".
  262. # # Example: "@irc.example.com_Alice:example.com"
  263. # userTemplate: "@irc_$NICK"
  264. # # The display name to use for created Matrix clients. This should have
  265. # # $NICK somewhere in it if it is specified. Can also use $SERVER to
  266. # # insert the IRC domain.
  267. # # Optional. Default: "$NICK (IRC)". Example: "Alice (IRC)"
  268. # displayName: "$NICK (IRC)"
  269. # # Number of tries a client can attempt to join a room before the request
  270. # # is discarded. You can also use -1 to never retry or 0 to never give up.
  271. # # Optional. Default: -1
  272. # joinAttempts: -1
  273. # # Configuration for virtual IRC users. The following variables are exposed:
  274. # # $LOCALPART => The user ID localpart ("alice" in @alice:localhost)
  275. # # $USERID => The user ID
  276. # # $DISPLAY => The display name of this user, with excluded characters
  277. # # (e.g. space) removed. If the user has no display name, this
  278. # # falls back to $LOCALPART.
  279. # ircClients:
  280. # # The template to apply to every IRC client nick. This MUST have either
  281. # # $DISPLAY or $USERID or $LOCALPART somewhere in it.
  282. # # Optional. Default: "M-$DISPLAY". Example: "M-Alice".
  283. # nickTemplate: "$DISPLAY[m]"
  284. # # True to allow virtual IRC clients to change their nick on this server
  285. # # by issuing !nick <server> <nick> commands to the IRC AS bot.
  286. # # This is completely freeform: it will NOT follow the nickTemplate.
  287. # allowNickChanges: true
  288. # # The max number of IRC clients that will connect. If the limit is
  289. # # reached, the client that spoke the longest time ago will be
  290. # # disconnected and replaced.
  291. # # Optional. Default: 30.
  292. # maxClients: 30
  293. # # IPv6 configuration.
  294. # ipv6:
  295. # # Optional. Set to true to force IPv6 for outgoing connections.
  296. # only: false
  297. # # Optional. The IPv6 prefix to use for generating unique addresses for each
  298. # # connected user. If not specified, all users will connect from the same
  299. # # (default) address. This may require additional OS-specific work to allow
  300. # # for the node process to bind to multiple different source addresses
  301. # # e.g IP_FREEBIND on Linux, which requires an LD_PRELOAD with the library
  302. # # https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
  303. # # prefix: "2001:0db8:85a3::" # modify appropriately
  304. # #
  305. # # The maximum amount of time in seconds that the client can exist
  306. # # without sending another message before being disconnected. Use 0 to
  307. # # not apply an idle timeout. This value is ignored if this IRC server is
  308. # # mirroring Matrix membership lists to IRC. Default: 172800 (48 hours)
  309. # idleTimeout: 10800
  310. # # The number of millseconds to wait between consecutive reconnections if a
  311. # # client gets disconnected. Setting to 0 will cause the scheduling to be
  312. # # disabled, i.e. it will be scheduled immediately (with jitter.
  313. # # Otherwise, the scheduling interval will be used such that one client
  314. # # reconnect for this server will be handled every reconnectIntervalMs ms using
  315. # # a FIFO queue.
  316. # # Default: 5000 (5 seconds)
  317. # reconnectIntervalMs: 5000
  318. # # The number of concurrent reconnects if a user has been disconnected unexpectedly
  319. # # (e.g. a netsplit). You should set this to a reasonably high number so that
  320. # # bridges are not waiting an eternity to reconnect all its clients if
  321. # # we see a massive number of disconnect. This is unrelated to the reconnectIntervalMs
  322. # # setting above which is for connecting on restart of the bridge. Set to 0 to
  323. # # immediately try to reconnect all users.
  324. # # Default: 50
  325. # concurrentReconnectLimit: 50
  326. # # The number of lines to allow being sent by the IRC client that has received
  327. # # a large block of text to send from matrix. If the number of lines that would
  328. # # be sent is > lineLimit, the text will instead be uploaded to Matrix and the
  329. # # resulting URI is treated as a file. As such, a link will be sent to the IRC
  330. # # side instead of potentially spamming IRC and getting the IRC client kicked.
  331. # # Default: 3.
  332. # lineLimit: 3
  333. # # A list of user modes to set on every IRC client. For example, "RiG" would set
  334. # # +R, +i and +G on every IRC connection when they have successfully connected.
  335. # # User modes vary wildly depending on the IRC network you're connecting to,
  336. # # so check before setting this value. Some modes may not work as intended
  337. # # through the bridge e.g. caller ID as there is no way to /ACCEPT.
  338. # # Default: "" (no user modes)
  339. # # userModes: "R"
  340. # Controls whether the matrix-appservice-discord container exposes its HTTP port (tcp/9999 in the container).
  341. #
  342. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9999"), or empty string to not expose.
  343. matrix_appservice_irc_container_http_host_bind_port: ''
  344. matrix_appservice_irc_container_network: ""
  345. matrix_appservice_irc_container_additional_networks: "{{ matrix_appservice_irc_container_additional_networks_auto + matrix_appservice_irc_container_additional_networks_custom }}"
  346. matrix_appservice_irc_container_additional_networks_auto: []
  347. matrix_appservice_irc_container_additional_networks_custom: []
  348. # A list of extra arguments to pass to the container
  349. matrix_appservice_irc_container_extra_arguments: []
  350. # List of systemd services that matrix-appservice-irc.service depends on.
  351. matrix_appservice_irc_systemd_required_services_list: "{{ matrix_appservice_irc_systemd_required_services_list_default + matrix_appservice_irc_systemd_required_services_list_auto + matrix_appservice_irc_systemd_required_services_list_custom }}"
  352. matrix_appservice_irc_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
  353. matrix_appservice_irc_systemd_required_services_list_auto: []
  354. matrix_appservice_irc_systemd_required_services_list_custom: []
  355. # List of systemd services that matrix-appservice-irc.service wants
  356. matrix_appservice_irc_systemd_wanted_services_list: []
  357. matrix_appservice_irc_appservice_token: ''
  358. matrix_appservice_irc_homeserver_token: ''
  359. matrix_appservice_irc_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
  360. matrix_appservice_irc_configuration_extension_yaml: |
  361. # Your custom YAML configuration for Appservice IRC servers goes here.
  362. # This configuration extends the default starting configuration (`matrix_appservice_irc_configuration_yaml`).
  363. #
  364. # You can override individual variables from the default configuration, or introduce new ones.
  365. #
  366. # If you need something more special, you can take full control by
  367. # completely redefining `matrix_appservice_irc_configuration_yaml`.
  368. matrix_appservice_irc_configuration_extension: "{{ matrix_appservice_irc_configuration_extension_yaml | from_yaml if matrix_appservice_irc_configuration_extension_yaml | from_yaml is mapping else {} }}"
  369. matrix_appservice_irc_configuration: "{{ matrix_appservice_irc_configuration_yaml | from_yaml | combine(matrix_appservice_irc_configuration_extension, recursive=True) }}"
  370. # The original registration.yaml file generated by AppService IRC is merged with this config override,
  371. # to produce the final registration.yaml file ultimately used by both the bridge and the homeserver.
  372. #
  373. # We do this to ensure consistency:
  374. # - always having an up-to-date registration.yaml file (synced with the configuration file)
  375. # - always having the same AS/HS token and appservice ID in the registration.yaml file
  376. #
  377. # Learn more about this in `setup_install.yml`
  378. matrix_appservice_irc_registration_override_yaml: |
  379. id: appservice-irc
  380. as_token: "{{ matrix_appservice_irc_appservice_token }}"
  381. hs_token: "{{ matrix_appservice_irc_homeserver_token }}"
  382. matrix_appservice_irc_registration_override: "{{ matrix_appservice_irc_registration_override_yaml | from_yaml }}"