mirror of
				https://github.com/spantaleev/matrix-docker-ansible-deploy.git
				synced 2025-11-04 00:58:56 +01:00 
			
		
		
		
	Merge pull request #557 from izissise/mx-puppet-steam
Add mx-puppet-steam
This commit is contained in:
		@@ -164,6 +164,8 @@ This playbook sets up your server using the following Docker images:
 | 
			
		||||
 | 
			
		||||
- [sorunome/mx-puppet-discord](https://hub.docker.com/r/sorunome/mx-puppet-discord) - the [mx-puppet-discord](https://github.com/matrix-discord/mx-puppet-discord) bridge to [Discord](https:/discordapp.com) (optional)
 | 
			
		||||
 | 
			
		||||
- [icewind1991/mx-puppet-steam](https://hub.docker.com/r/icewind1991/mx-puppet-steam) - the [mx-puppet-steam](https://github.com/icewind1991/mx-puppet-steam) bridge to [Steam](https://steampowered.com) (optional)
 | 
			
		||||
 | 
			
		||||
- [turt2live/matrix-dimension](https://hub.docker.com/r/turt2live/matrix-dimension) - the [Dimension](https://dimension.t2bot.io/) integrations manager (optional)
 | 
			
		||||
 | 
			
		||||
- [jitsi/web](https://hub.docker.com/r/jitsi/web) - the [Jitsi](https://jitsi.org/) web UI (optional)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								docs/configuring-playbook-bridge-mx-puppet-steam.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								docs/configuring-playbook-bridge-mx-puppet-steam.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
# Setting up MX Puppet Steam (optional)
 | 
			
		||||
 | 
			
		||||
The playbook can install and configure
 | 
			
		||||
[mx-puppet-steam](https://github.com/matrix-steam/mx-puppet-steam) for you.
 | 
			
		||||
 | 
			
		||||
See the project page to learn what it does and why it might be useful to you.
 | 
			
		||||
 | 
			
		||||
To enable the [Steam](https://steamapp.com/) bridge just use the following
 | 
			
		||||
playbook configuration:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
matrix_mx_puppet_steam_enabled: true
 | 
			
		||||
matrix_mx_puppet_steam_client_id: ""
 | 
			
		||||
matrix_mx_puppet_steam_client_secret: ""
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
Once the bot is enabled you need to start a chat with `Steam Puppet Bridge` with
 | 
			
		||||
the handle `@_steampuppet_bot:YOUR_DOMAIN` (where `YOUR_DOMAIN` is your base
 | 
			
		||||
domain, not the `matrix.` domain).
 | 
			
		||||
 | 
			
		||||
Three authentication methods are available, Legacy Token, OAuth and xoxc token.
 | 
			
		||||
See mx-puppet-steam [documentation](https://github.com/matrix-steam/mx-puppet-steam)
 | 
			
		||||
for more information about how to configure the bridge.
 | 
			
		||||
 | 
			
		||||
Once logged in, send `list` to the bot user to list the available rooms.
 | 
			
		||||
 | 
			
		||||
Clicking rooms in the list will result in you receiving an invitation to the
 | 
			
		||||
bridged room.
 | 
			
		||||
 | 
			
		||||
Also send `help` to the bot to see the commands available.
 | 
			
		||||
@@ -486,6 +486,35 @@ matrix_mx_puppet_discord_login_shared_secret: "{{ matrix_synapse_ext_password_pr
 | 
			
		||||
#
 | 
			
		||||
######################################################################
 | 
			
		||||
 | 
			
		||||
######################################################################
 | 
			
		||||
#
 | 
			
		||||
# matrix-bridge-mx-puppet-steam
 | 
			
		||||
#
 | 
			
		||||
######################################################################
 | 
			
		||||
 | 
			
		||||
# We don't enable bridges by default.
 | 
			
		||||
matrix_mx_puppet_steam_enabled: false
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_container_image_self_build: "{{ matrix_architecture != 'amd64'}}"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_systemd_required_services_list: |
 | 
			
		||||
  {{
 | 
			
		||||
    ['docker.service']
 | 
			
		||||
    +
 | 
			
		||||
    (['matrix-synapse.service'] if matrix_synapse_enabled else [])
 | 
			
		||||
  }}
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxste.as.tok') | to_uuid }}"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxste.hs.tok') | to_uuid }}"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
 | 
			
		||||
 | 
			
		||||
######################################################################
 | 
			
		||||
#
 | 
			
		||||
# /matrix-bridge-mx-puppet-steam
 | 
			
		||||
#
 | 
			
		||||
######################################################################
 | 
			
		||||
 | 
			
		||||
######################################################################
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										95
									
								
								roles/matrix-bridge-mx-puppet-steam/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								roles/matrix-bridge-mx-puppet-steam/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,95 @@
 | 
			
		||||
# Mx Puppet Steam is a Matrix <-> Steam bridge
 | 
			
		||||
# See: https://github.com/matrix-steam/mx-puppet-steam
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_enabled: true
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_container_image_self_build: false
 | 
			
		||||
 | 
			
		||||
# Controls whether the mx-puppet-steam container exposes its HTTP port (tcp/8432 in the container).
 | 
			
		||||
#
 | 
			
		||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8432"), or empty string to not expose.
 | 
			
		||||
matrix_mx_puppet_steam_container_http_host_bind_port: ''
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_docker_image: "icewind1991/mx-puppet-steam:latest"
 | 
			
		||||
matrix_mx_puppet_steam_docker_image_force_pull: "{{ matrix_mx_puppet_steam_docker_image.endswith(':latest') }}"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_base_path: "{{ matrix_base_data_path }}/mx-puppet-steam"
 | 
			
		||||
matrix_mx_puppet_steam_config_path: "{{ matrix_mx_puppet_steam_base_path }}/config"
 | 
			
		||||
matrix_mx_puppet_steam_data_path: "{{ matrix_mx_puppet_steam_base_path }}/data"
 | 
			
		||||
matrix_mx_puppet_steam_docker_src_files_path: "{{ matrix_mx_puppet_steam_base_path }}/docker-src"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_appservice_port: "8432"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_homeserver_address: 'http://matrix-synapse:8008'
 | 
			
		||||
matrix_mx_puppet_steam_homeserver_domain: '{{ matrix_domain }}'
 | 
			
		||||
matrix_mx_puppet_steam_appservice_address: 'http://matrix-mx-puppet-steam:{{ matrix_mx_puppet_steam_appservice_port }}'
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_client_id: ''
 | 
			
		||||
matrix_mx_puppet_steam_client_secret: ''
 | 
			
		||||
 | 
			
		||||
# "@user:server.com" to allow specific user
 | 
			
		||||
# "@.*:yourserver.com" to allow users on a specific homeserver
 | 
			
		||||
# "@.*" to allow anyone
 | 
			
		||||
matrix_mx_puppet_steam_provisioning_whitelist:
 | 
			
		||||
  - "@.*:{{ matrix_domain|regex_escape }}"
 | 
			
		||||
 | 
			
		||||
# Leave empty to disable blacklist
 | 
			
		||||
# "@user:server.com" disallow a specific user
 | 
			
		||||
# "@.*:yourserver.com" disallow users on a specific homeserver
 | 
			
		||||
matrix_mx_puppet_steam_provisioning_blacklist: []
 | 
			
		||||
 | 
			
		||||
# A list of extra arguments to pass to the container
 | 
			
		||||
matrix_mx_puppet_steam_container_extra_arguments: []
 | 
			
		||||
 | 
			
		||||
# List of systemd services that matrix-puppet-steam.service depends on.
 | 
			
		||||
matrix_mx_puppet_steam_systemd_required_services_list: ['docker.service']
 | 
			
		||||
 | 
			
		||||
# List of systemd services that matrix-puppet-steam.service wants
 | 
			
		||||
matrix_mx_puppet_steam_systemd_wanted_services_list: []
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_appservice_token: ''
 | 
			
		||||
matrix_mx_puppet_steam_homeserver_token: ''
 | 
			
		||||
 | 
			
		||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
 | 
			
		||||
matrix_mx_puppet_steam_login_shared_secret: ''
 | 
			
		||||
 | 
			
		||||
# Default configuration template which covers the generic use case.
 | 
			
		||||
# You can customize it by controlling the various variables inside it.
 | 
			
		||||
#
 | 
			
		||||
# For a more advanced customization, you can extend the default (see `matrix_mx_puppet_steam_configuration_extension_yaml`)
 | 
			
		||||
# or completely replace this variable with your own template.
 | 
			
		||||
matrix_mx_puppet_steam_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_configuration_extension_yaml: |
 | 
			
		||||
  # Your custom YAML configuration goes here.
 | 
			
		||||
  # This configuration extends the default starting configuration (`matrix_mx_puppet_steam_configuration_yaml`).
 | 
			
		||||
  #
 | 
			
		||||
  # You can override individual variables from the default configuration, or introduce new ones.
 | 
			
		||||
  #
 | 
			
		||||
  # If you need something more special, you can take full control by
 | 
			
		||||
  # completely redefining `matrix_mx_puppet_steam_configuration_yaml`.
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_configuration_extension: "{{ matrix_mx_puppet_steam_configuration_extension_yaml|from_yaml if matrix_mx_puppet_steam_configuration_extension_yaml|from_yaml is mapping else {} }}"
 | 
			
		||||
 | 
			
		||||
# Holds the final configuration (a combination of the default and its extension).
 | 
			
		||||
# You most likely don't need to touch this variable. Instead, see `matrix_mx_puppet_steam_configuration_yaml`.
 | 
			
		||||
matrix_mx_puppet_steam_configuration: "{{ matrix_mx_puppet_steam_configuration_yaml|from_yaml|combine(matrix_mx_puppet_steam_configuration_extension, recursive=True) }}"
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_registration_yaml: |
 | 
			
		||||
  as_token: "{{ matrix_mx_puppet_steam_appservice_token }}"
 | 
			
		||||
  hs_token: "{{ matrix_mx_puppet_steam_homeserver_token }}"
 | 
			
		||||
  id: steam-puppet
 | 
			
		||||
  namespaces:
 | 
			
		||||
    users:
 | 
			
		||||
      - exclusive: true
 | 
			
		||||
        regex: '@_steampuppet_.*:{{ matrix_mx_puppet_steam_homeserver_domain|regex_escape }}'
 | 
			
		||||
    rooms: []
 | 
			
		||||
    aliases:
 | 
			
		||||
      - exclusive: true
 | 
			
		||||
        regex: '#_steampuppet_.*:{{ matrix_mx_puppet_steam_homeserver_domain|regex_escape }}'
 | 
			
		||||
  protocols: []
 | 
			
		||||
  rate_limited: false
 | 
			
		||||
  sender_localpart: _steampuppet_bot
 | 
			
		||||
  url: {{ matrix_mx_puppet_steam_appservice_address }}
 | 
			
		||||
 | 
			
		||||
matrix_mx_puppet_steam_registration: "{{ matrix_mx_puppet_steam_registration_yaml|from_yaml }}"
 | 
			
		||||
							
								
								
									
										23
									
								
								roles/matrix-bridge-mx-puppet-steam/tasks/init.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								roles/matrix-bridge-mx-puppet-steam/tasks/init.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
- set_fact:
 | 
			
		||||
    matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-steam'] }}"
 | 
			
		||||
  when: matrix_mx_puppet_steam_enabled|bool
 | 
			
		||||
 | 
			
		||||
# If the matrix-synapse role is not used, these variables may not exist.
 | 
			
		||||
- set_fact:
 | 
			
		||||
    matrix_synapse_container_extra_arguments: >
 | 
			
		||||
      {{ matrix_synapse_container_extra_arguments|default([]) }}
 | 
			
		||||
      +
 | 
			
		||||
      ["--mount type=bind,src={{ matrix_mx_puppet_steam_config_path }}/registration.yaml,dst=/matrix-mx-puppet-steam-registration.yaml,ro"]
 | 
			
		||||
 | 
			
		||||
    matrix_synapse_app_service_config_files: >
 | 
			
		||||
      {{ matrix_synapse_app_service_config_files|default([]) }}
 | 
			
		||||
      +
 | 
			
		||||
      {{ ["/matrix-mx-puppet-steam-registration.yaml"] }}
 | 
			
		||||
  when: matrix_mx_puppet_steam_enabled|bool
 | 
			
		||||
 | 
			
		||||
# ansible lower than 2.8, does not support docker_image build parameters
 | 
			
		||||
# for self buildig it is explicitly needed, so we rather fail here
 | 
			
		||||
- name: Fail if running on Ansible lower than 2.8 and trying self building
 | 
			
		||||
  fail:
 | 
			
		||||
    msg: "To self build Puppet Slack image, you should usa ansible 2.8 or higher. E.g. pip contains such packages."
 | 
			
		||||
  when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mx_puppet_steam_container_image_self_build"
 | 
			
		||||
							
								
								
									
										21
									
								
								roles/matrix-bridge-mx-puppet-steam/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								roles/matrix-bridge-mx-puppet-steam/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
- import_tasks: "{{ role_path }}/tasks/init.yml"
 | 
			
		||||
  tags:
 | 
			
		||||
    - always
 | 
			
		||||
 | 
			
		||||
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
 | 
			
		||||
  when: "run_setup|bool and matrix_mx_puppet_steam_enabled|bool"
 | 
			
		||||
  tags:
 | 
			
		||||
    - setup-all
 | 
			
		||||
    - setup-mx-puppet-steam
 | 
			
		||||
 | 
			
		||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
 | 
			
		||||
  when: "run_setup|bool and matrix_mx_puppet_steam_enabled|bool"
 | 
			
		||||
  tags:
 | 
			
		||||
    - setup-all
 | 
			
		||||
    - setup-mx-puppet-steam
 | 
			
		||||
 | 
			
		||||
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
 | 
			
		||||
  when: "run_setup|bool and not matrix_mx_puppet_steam_enabled|bool"
 | 
			
		||||
  tags:
 | 
			
		||||
    - setup-all
 | 
			
		||||
    - setup-mx-puppet-steam
 | 
			
		||||
							
								
								
									
										93
									
								
								roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
 | 
			
		||||
# We don't want to fail in such cases.
 | 
			
		||||
- name: Fail if matrix-synapse role already executed
 | 
			
		||||
  fail:
 | 
			
		||||
    msg: >-
 | 
			
		||||
      The matrix-bridge-mx-puppet-steam role needs to execute before the matrix-synapse role.
 | 
			
		||||
  when: "matrix_synapse_role_executed|default(False)"
 | 
			
		||||
 | 
			
		||||
- name: Ensure MX Puppet Steam image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_mx_puppet_steam_docker_image }}"
 | 
			
		||||
    source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
 | 
			
		||||
    force_source: "{{ matrix_mx_puppet_steam_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
 | 
			
		||||
    force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_steam_docker_image_force_pull }}"
 | 
			
		||||
  when: matrix_mx_puppet_steam_enabled|bool and not matrix_mx_puppet_steam_container_image_self_build
 | 
			
		||||
 | 
			
		||||
- name: Ensure MX Puppet Steam paths exist
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ item.path }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
    mode: 0750
 | 
			
		||||
    owner: "{{ matrix_user_username }}"
 | 
			
		||||
    group: "{{ matrix_user_groupname }}"
 | 
			
		||||
  with_items:
 | 
			
		||||
    - { path: "{{ matrix_mx_puppet_steam_base_path }}", when: true }
 | 
			
		||||
    - { path: "{{ matrix_mx_puppet_steam_config_path }}", when: true }
 | 
			
		||||
    - { path: "{{ matrix_mx_puppet_steam_data_path }}", when: true }
 | 
			
		||||
    - { path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}", when: "{{ matrix_mx_puppet_steam_container_image_self_build }}" }
 | 
			
		||||
  when: matrix_mx_puppet_steam_enabled|bool and item.when|bool
 | 
			
		||||
 | 
			
		||||
- name: Ensure MX Puppet Steam repository is present on self build
 | 
			
		||||
  git:
 | 
			
		||||
    repo: https://github.com/matrix-steam/mx-puppet-steam.git
 | 
			
		||||
    dest: "{{ matrix_mx_puppet_steam_docker_src_files_path }}"
 | 
			
		||||
    force: "yes"
 | 
			
		||||
  when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build"
 | 
			
		||||
 | 
			
		||||
- name: Ensure MX Puppet Steam Docker image is built
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_mx_puppet_steam_docker_image }}"
 | 
			
		||||
    source: build
 | 
			
		||||
    build:
 | 
			
		||||
      dockerfile: Dockerfile
 | 
			
		||||
      path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}"
 | 
			
		||||
      pull: yes
 | 
			
		||||
  when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build"
 | 
			
		||||
 | 
			
		||||
- name: Check if an old database file already exists
 | 
			
		||||
  stat:
 | 
			
		||||
    path: "{{ matrix_mx_puppet_steam_base_path }}/database.db"
 | 
			
		||||
  register: matrix_mx_puppet_steam_stat_database
 | 
			
		||||
 | 
			
		||||
- name: (Data relocation) Ensure matrix-mx-puppet-steam.service is stopped
 | 
			
		||||
  service:
 | 
			
		||||
    name: matrix-mx-puppet-steam
 | 
			
		||||
    state: stopped
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
  failed_when: false
 | 
			
		||||
  when: "matrix_mx_puppet_steam_stat_database.stat.exists"
 | 
			
		||||
 | 
			
		||||
- name: (Data relocation) Move mx-puppet-steam database file to ./data directory
 | 
			
		||||
  command: "mv {{ matrix_mx_puppet_steam_base_path }}/database.db {{ matrix_mx_puppet_steam_data_path }}/database.db"
 | 
			
		||||
  when: "matrix_mx_puppet_steam_stat_database.stat.exists"
 | 
			
		||||
 | 
			
		||||
- name: Ensure mx-puppet-steam config.yaml installed
 | 
			
		||||
  copy:
 | 
			
		||||
    content: "{{ matrix_mx_puppet_steam_configuration|to_nice_yaml }}"
 | 
			
		||||
    dest: "{{ matrix_mx_puppet_steam_config_path }}/config.yaml"
 | 
			
		||||
    mode: 0644
 | 
			
		||||
    owner: "{{ matrix_user_username }}"
 | 
			
		||||
    group: "{{ matrix_user_groupname }}"
 | 
			
		||||
 | 
			
		||||
- name: Ensure mx-puppet-steam steam-registration.yaml installed
 | 
			
		||||
  copy:
 | 
			
		||||
    content: "{{ matrix_mx_puppet_steam_registration|to_nice_yaml }}"
 | 
			
		||||
    dest: "{{ matrix_mx_puppet_steam_config_path }}/registration.yaml"
 | 
			
		||||
    mode: 0644
 | 
			
		||||
    owner: "{{ matrix_user_username }}"
 | 
			
		||||
    group: "{{ matrix_user_groupname }}"
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-mx-puppet-steam.service installed
 | 
			
		||||
  template:
 | 
			
		||||
    src: "{{ role_path }}/templates/systemd/matrix-mx-puppet-steam.service.j2"
 | 
			
		||||
    dest: "/etc/systemd/system/matrix-mx-puppet-steam.service"
 | 
			
		||||
    mode: 0644
 | 
			
		||||
  register: matrix_mx_puppet_steam_systemd_service_result
 | 
			
		||||
 | 
			
		||||
- name: Ensure systemd reloaded after matrix-mx-puppet-steam.service installation
 | 
			
		||||
  service:
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
  when: "matrix_mx_puppet_steam_systemd_service_result.changed"
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
- name: Check existence of matrix-mx-puppet-steam service
 | 
			
		||||
  stat:
 | 
			
		||||
    path: "/etc/systemd/system/matrix-mx-puppet-steam.service"
 | 
			
		||||
  register: matrix_mx_puppet_steam_service_stat
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-mx-puppet-steam is stopped
 | 
			
		||||
  service:
 | 
			
		||||
    name: matrix-mx-puppet-steam
 | 
			
		||||
    state: stopped
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
  when: "matrix_mx_puppet_steam_service_stat.stat.exists"
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-mx-puppet-steam.service doesn't exist
 | 
			
		||||
  file:
 | 
			
		||||
    path: "/etc/systemd/system/matrix-mx-puppet-steam.service"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "matrix_mx_puppet_steam_service_stat.stat.exists"
 | 
			
		||||
 | 
			
		||||
- name: Ensure systemd reloaded after matrix-mx-puppet-steam.service removal
 | 
			
		||||
  service:
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
  when: "matrix_mx_puppet_steam_service_stat.stat.exists"
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
- name: Fail if required settings not defined
 | 
			
		||||
  fail:
 | 
			
		||||
    msg: >-
 | 
			
		||||
      You need to define a required configuration setting (`{{ item }}`).
 | 
			
		||||
  when: "vars[item] == ''"
 | 
			
		||||
  with_items:
 | 
			
		||||
    - "matrix_mx_puppet_steam_appservice_token"
 | 
			
		||||
    - "matrix_mx_puppet_steam_homeserver_token"
 | 
			
		||||
							
								
								
									
										99
									
								
								roles/matrix-bridge-mx-puppet-steam/templates/config.yaml.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								roles/matrix-bridge-mx-puppet-steam/templates/config.yaml.j2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,99 @@
 | 
			
		||||
#jinja2: lstrip_blocks: "True"
 | 
			
		||||
bridge:
 | 
			
		||||
  # Port to host the bridge on
 | 
			
		||||
  # Used for communication between the homeserver and the bridge
 | 
			
		||||
  port: {{ matrix_mx_puppet_steam_appservice_port }}
 | 
			
		||||
  # The host connections to the bridge's webserver are allowed from
 | 
			
		||||
  bindAddress: 0.0.0.0
 | 
			
		||||
  # Public domain of the homeserver
 | 
			
		||||
  domain: {{ matrix_mx_puppet_steam_homeserver_domain }}
 | 
			
		||||
  # Reachable URL of the Matrix homeserver
 | 
			
		||||
  homeserverUrl: {{ matrix_mx_puppet_steam_homeserver_address }}
 | 
			
		||||
  {% if matrix_mx_puppet_steam_login_shared_secret != '' %}
 | 
			
		||||
  loginSharedSecretMap:
 | 
			
		||||
    {{ matrix_domain }}: {{ matrix_mx_puppet_steam_login_shared_secret }}
 | 
			
		||||
  {% endif %}
 | 
			
		||||
  # Display name of the bridge bot
 | 
			
		||||
  displayname: Steam Puppet Bridge
 | 
			
		||||
  # Optionally specify a different media URL used for the media store
 | 
			
		||||
  #
 | 
			
		||||
  # This is where Steam will download user profile pictures and media
 | 
			
		||||
  # from
 | 
			
		||||
  #mediaUrl: https://external-url.org
 | 
			
		||||
 | 
			
		||||
presence:
 | 
			
		||||
  # Bridge Steam online/offline status
 | 
			
		||||
  enabled: true
 | 
			
		||||
  # How often to send status to the homeserver in milliseconds
 | 
			
		||||
  interval: 5000
 | 
			
		||||
 | 
			
		||||
provisioning:
 | 
			
		||||
  # Regex of Matrix IDs allowed to use the puppet bridge
 | 
			
		||||
  whitelist: {{ matrix_mx_puppet_steam_provisioning_whitelist|to_json }}
 | 
			
		||||
    # Allow a specific user
 | 
			
		||||
    #- "@user:server\\.com"
 | 
			
		||||
    # Allow users on a specific homeserver
 | 
			
		||||
    #- "@.*:yourserver\\.com"
 | 
			
		||||
    # Allow anyone
 | 
			
		||||
    #- ".*"
 | 
			
		||||
  # Regex of Matrix IDs forbidden from using the puppet bridge
 | 
			
		||||
  #blacklist:
 | 
			
		||||
    # Disallow a specific user
 | 
			
		||||
    #- "@user:server\\.com"
 | 
			
		||||
    # Disallow users on a specific homeserver
 | 
			
		||||
    #- "@.*:yourserver\\.com"
 | 
			
		||||
  blacklist: {{ matrix_mx_puppet_steam_provisioning_blacklist|to_json }}
 | 
			
		||||
 | 
			
		||||
relay:
 | 
			
		||||
  # Regex of Matrix IDs who are allowed to use the bridge in relay mode.
 | 
			
		||||
  # Relay mode is when a single Steam bot account relays messages of
 | 
			
		||||
  # multiple Matrix users
 | 
			
		||||
  #
 | 
			
		||||
  # Same format as in provisioning
 | 
			
		||||
  whitelist: {{ matrix_mx_puppet_steam_provisioning_whitelist|to_json }}
 | 
			
		||||
  blacklist: {{ matrix_mx_puppet_steam_provisioning_blacklist|to_json }}
 | 
			
		||||
 | 
			
		||||
selfService:
 | 
			
		||||
  # Regex of Matrix IDs who are allowed to use bridge self-servicing (plumbed rooms)
 | 
			
		||||
  #
 | 
			
		||||
  # Same format as in provisioning
 | 
			
		||||
  whitelist: {{ matrix_mx_puppet_steam_provisioning_whitelist|to_json }}
 | 
			
		||||
  blacklist: {{ matrix_mx_puppet_steam_provisioning_blacklist|to_json }}
 | 
			
		||||
 | 
			
		||||
database:
 | 
			
		||||
  # Use Postgres as a database backend
 | 
			
		||||
  # If set, will be used instead of SQLite3
 | 
			
		||||
  # Connection string to connect to the Postgres instance
 | 
			
		||||
  # with username "user", password "pass", host "localhost" and database name "dbname".
 | 
			
		||||
  # Modify each value as necessary
 | 
			
		||||
  #connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
 | 
			
		||||
  # Use SQLite3 as a database backend
 | 
			
		||||
  # The name of the database file
 | 
			
		||||
  filename: /data/database.db
 | 
			
		||||
 | 
			
		||||
logging:
 | 
			
		||||
  # Log level of console output
 | 
			
		||||
  # Allowed values starting with most verbose:
 | 
			
		||||
  # silly, debug, verbose, info, warn, error
 | 
			
		||||
  console: info
 | 
			
		||||
  # Date and time formatting
 | 
			
		||||
  lineDateFormat: MMM-D HH:mm:ss.SSS
 | 
			
		||||
  # Logging files
 | 
			
		||||
  # Log files are rotated daily by default
 | 
			
		||||
  files:
 | 
			
		||||
    # Log file path
 | 
			
		||||
    - file: "/data/bridge.log"
 | 
			
		||||
      # Log level for this file
 | 
			
		||||
      # Allowed values starting with most verbose:
 | 
			
		||||
      # silly, debug, verbose, info, warn, error
 | 
			
		||||
      level: info
 | 
			
		||||
      # Date and time formatting
 | 
			
		||||
      datePattern: YYYY-MM-DD
 | 
			
		||||
      # Maximum number of logs to keep.
 | 
			
		||||
      # This can be a number of files or number of days.
 | 
			
		||||
      # If using days, add 'd' as a suffix
 | 
			
		||||
      maxFiles: 14d
 | 
			
		||||
      # Maximum size of the file after which it will rotate. This can be a
 | 
			
		||||
      # number of bytes, or units of kb, mb, and gb. If using the units, add
 | 
			
		||||
      # 'k', 'm', or 'g' as the suffix
 | 
			
		||||
      maxSize: 50m
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
#jinja2: lstrip_blocks: "True"
 | 
			
		||||
[Unit]
 | 
			
		||||
Description=Matrix Mx Puppet Steam server
 | 
			
		||||
{% for service in matrix_mx_puppet_steam_systemd_required_services_list %}
 | 
			
		||||
Requires={{ service }}
 | 
			
		||||
After={{ service }}
 | 
			
		||||
{% endfor %}
 | 
			
		||||
{% for service in matrix_mx_puppet_steam_systemd_wanted_services_list %}
 | 
			
		||||
Wants={{ service }}
 | 
			
		||||
{% endfor %}
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
Type=simple
 | 
			
		||||
ExecStartPre=-{{ matrix_host_command_docker }} kill matrix-mx-puppet-steam
 | 
			
		||||
ExecStartPre=-{{ matrix_host_command_docker }} rm matrix-mx-puppet-steam
 | 
			
		||||
 | 
			
		||||
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
 | 
			
		||||
ExecStartPre={{ matrix_host_command_sleep }} 5
 | 
			
		||||
 | 
			
		||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-mx-puppet-steam \
 | 
			
		||||
			--log-driver=none \
 | 
			
		||||
			--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
 | 
			
		||||
			--cap-drop=ALL \
 | 
			
		||||
			--network={{ matrix_docker_network }} \
 | 
			
		||||
			-e CONFIG_PATH=/config/config.yaml \
 | 
			
		||||
			-e REGISTRATION_PATH=/config/registration.yaml \
 | 
			
		||||
			-v {{ matrix_mx_puppet_steam_config_path }}:/config:z \
 | 
			
		||||
			-v {{ matrix_mx_puppet_steam_data_path }}:/data:z \
 | 
			
		||||
			{% for arg in matrix_mx_puppet_steam_container_extra_arguments %}
 | 
			
		||||
			{{ arg }} \
 | 
			
		||||
			{% endfor %}
 | 
			
		||||
			{{ matrix_mx_puppet_steam_docker_image }}
 | 
			
		||||
 | 
			
		||||
ExecStop=-{{ matrix_host_command_docker }} kill matrix-mx-puppet-steam
 | 
			
		||||
ExecStop=-{{ matrix_host_command_docker }} rm matrix-mx-puppet-steam
 | 
			
		||||
Restart=always
 | 
			
		||||
RestartSec=30
 | 
			
		||||
SyslogIdentifier=matrix-mx-puppet-steam
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=multi-user.target
 | 
			
		||||
		Reference in New Issue
	
	Block a user