From 75b1528d139117f5cfc19151b6af3838b6a3aad0 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Tue, 30 Apr 2019 16:35:18 +0200 Subject: [PATCH] Add the possibility to pass extra flags to the docker container --- roles/matrix-corporal/defaults/main.yml | 3 +++ .../templates/systemd/matrix-corporal.service.j2 | 3 +++ roles/matrix-coturn/defaults/main.yml | 3 +++ roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 | 3 +++ roles/matrix-dimension/defaults/main.yml | 3 +++ .../templates/systemd/matrix-dimension.service.j2 | 3 +++ roles/matrix-mailer/defaults/main.yml | 3 +++ roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 | 3 +++ roles/matrix-mxisd/defaults/main.yml | 3 +++ roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 | 3 +++ roles/matrix-nginx-proxy/defaults/main.yml | 3 +++ .../templates/systemd/matrix-nginx-proxy.service.j2 | 3 +++ roles/matrix-postgres/defaults/main.yml | 3 +++ .../templates/systemd/matrix-postgres.service.j2 | 3 +++ roles/matrix-riot-web/defaults/main.yml | 3 +++ .../templates/systemd/matrix-riot-web.service.j2 | 3 +++ roles/matrix-synapse/defaults/main.yml | 3 +++ .../templates/synapse/systemd/matrix-synapse.service.j2 | 3 +++ 18 files changed, 54 insertions(+) diff --git a/roles/matrix-corporal/defaults/main.yml b/roles/matrix-corporal/defaults/main.yml index a1406f03..09bdbb56 100644 --- a/roles/matrix-corporal/defaults/main.yml +++ b/roles/matrix-corporal/defaults/main.yml @@ -6,6 +6,9 @@ matrix_corporal_enabled: true # Controls whether the matrix-corporal web server's ports (`41080` and `41081`) are exposed outside of the container. matrix_corporal_container_expose_ports: false +# A list of extra arguments to pass to the container +matrix_corporal_container_extra_arguments: [] + # List of systemd services that matrix-corporal.service depends on matrix_corporal_systemd_required_services_list: ['docker.service'] diff --git a/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 b/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 index 4035aa65..d0adbf9d 100644 --- a/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 +++ b/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 @@ -22,6 +22,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-corporal \ -v {{ matrix_corporal_config_dir_path }}:/etc/matrix-corporal:ro \ -v {{ matrix_corporal_cache_dir_path }}:/var/cache/matrix-corporal:rw \ -v {{ matrix_corporal_var_dir_path }}:/var/matrix-corporal:rw \ + {% for arg in matrix_corporal_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_corporal_docker_image }} \ /matrix-corporal -config=/etc/matrix-corporal/config.json ExecStop=-/usr/bin/docker kill matrix-corporal diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index b70c4058..b12cabe7 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -23,6 +23,9 @@ matrix_coturn_systemd_required_services_list: ['docker.service'] # Contains definition objects like this: `{"src": "/outside", "dst": "/inside", "options": "rw|ro|slave|.."} matrix_coturn_container_additional_volumes: [] +# A list of extra arguments to pass to the container +matrix_coturn_container_extra_arguments: [] + # A shared secret (between Synapse and Coturn) used for authentication. # You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`). matrix_coturn_turn_static_auth_secret: "" diff --git a/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 b/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 index b2d909f2..c1f00789 100644 --- a/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 +++ b/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 @@ -27,6 +27,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-coturn \ {% for volume in matrix_coturn_container_additional_volumes %} -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \ {% endfor %} + {% for arg in matrix_coturn_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_coturn_docker_image }} \ -c /turnserver.conf diff --git a/roles/matrix-dimension/defaults/main.yml b/roles/matrix-dimension/defaults/main.yml index 43841fee..b8acb9d7 100644 --- a/roles/matrix-dimension/defaults/main.yml +++ b/roles/matrix-dimension/defaults/main.yml @@ -20,6 +20,9 @@ matrix_dimension_user_gid: 1000 matrix_dimension_container_expose_port: false +# A list of extra arguments to pass to the container +matrix_dimension_container_extra_arguments: [] + matrix_dimension_integrations_ui_url: "https://{{ matrix_server_fqn_dimension }}/riot" matrix_dimension_integrations_rest_url: "https://{{ matrix_server_fqn_dimension }}/api/v1/scalar" matrix_dimension_integrations_widgets_urls: ["https://{{ matrix_server_fqn_dimension }}/widgets"] diff --git a/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 b/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 index 12f111f3..c176b3e7 100644 --- a/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 +++ b/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 @@ -19,6 +19,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-dimension \ -p 127.0.0.1:8184:8184 \ {% endif %} -v {{ matrix_dimension_base_path }}:/data:rw \ + {% for arg in matrix_dimension_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_dimension_docker_image }} ExecStop=-/usr/bin/docker kill matrix-dimension ExecStop=-/usr/bin/docker rm matrix-dimension diff --git a/roles/matrix-mailer/defaults/main.yml b/roles/matrix-mailer/defaults/main.yml index ffd00e36..184fd3cc 100644 --- a/roles/matrix-mailer/defaults/main.yml +++ b/roles/matrix-mailer/defaults/main.yml @@ -9,6 +9,9 @@ matrix_mailer_docker_image: "devture/exim-relay:4.91-r3-0" matrix_mailer_container_user_uid: 100 matrix_mailer_container_user_gid: 101 +# A list of extra arguments to pass to the container +matrix_mailer_container_extra_arguments: [] + matrix_mailer_sender_address: "matrix@{{ matrix_domain }}" matrix_mailer_relay_use: false matrix_mailer_relay_host_name: "mail.example.com" diff --git a/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 b/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 index f9e1348e..de07a687 100644 --- a/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 +++ b/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 @@ -16,6 +16,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mailer \ --network={{ matrix_docker_network }} \ --env-file={{ matrix_mailer_base_path }}/env-mailer \ --hostname={{ matrix_server_fqn_matrix }} \ + {% for arg in matrix_mailer_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_mailer_docker_image }} ExecStop=-/usr/bin/docker kill matrix-mailer ExecStop=-/usr/bin/docker rm matrix-mailer diff --git a/roles/matrix-mxisd/defaults/main.yml b/roles/matrix-mxisd/defaults/main.yml index caaccfd0..9ddeb72e 100644 --- a/roles/matrix-mxisd/defaults/main.yml +++ b/roles/matrix-mxisd/defaults/main.yml @@ -8,6 +8,9 @@ matrix_mxisd_data_path: "{{ matrix_mxisd_base_path }}/data" # Controls whether the mxisd web server's port (`8090`) is exposed outside of the container. matrix_mxisd_container_expose_port: false +# A list of extra arguments to pass to the container +matrix_mxisd_container_extra_arguments: [] + # List of systemd services that matrix-mxisd.service depends on matrix_mxisd_systemd_required_services_list: ['docker.service'] diff --git a/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 b/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 index de0c0681..6d951643 100644 --- a/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 +++ b/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 @@ -27,6 +27,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mxisd \ {% endif %} -v {{ matrix_mxisd_config_path }}:/etc/mxisd:ro \ -v {{ matrix_mxisd_data_path }}:/var/mxisd:rw \ + {% for arg in matrix_mxisd_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_mxisd_docker_image }} ExecStop=-/usr/bin/docker kill matrix-mxisd diff --git a/roles/matrix-nginx-proxy/defaults/main.yml b/roles/matrix-nginx-proxy/defaults/main.yml index beb0850e..96ceccd9 100644 --- a/roles/matrix-nginx-proxy/defaults/main.yml +++ b/roles/matrix-nginx-proxy/defaults/main.yml @@ -21,6 +21,9 @@ matrix_nginx_proxy_systemd_wanted_services_list: [] # Contains definition objects like this: `{"src": "/outside", "dst": "/inside", "options": "rw|ro|slave|.."} matrix_nginx_proxy_container_additional_volumes: [] +# A list of extra arguments to pass to the container +matrix_nginx_proxy_container_extra_arguments: [] + # Controls whether matrix-nginx-proxy should serve the base domain. # # This is useful for when you only have your Matrix server, but you need to serve diff --git a/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 b/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 index cb2c4da2..d3cf4044 100644 --- a/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 +++ b/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 @@ -33,6 +33,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-nginx-proxy \ {% for volume in matrix_nginx_proxy_container_additional_volumes %} -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \ {% endfor %} + {% for arg in matrix_nginx_proxy_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_nginx_proxy_docker_image }} ExecStop=-/usr/bin/docker kill matrix-nginx-proxy diff --git a/roles/matrix-postgres/defaults/main.yml b/roles/matrix-postgres/defaults/main.yml index 4b26f42d..1729a275 100644 --- a/roles/matrix-postgres/defaults/main.yml +++ b/roles/matrix-postgres/defaults/main.yml @@ -12,3 +12,6 @@ matrix_postgres_docker_image_v9: "postgres:9.6.12-alpine" matrix_postgres_docker_image_v10: "postgres:10.7-alpine" matrix_postgres_docker_image_v11: "postgres:11.2-alpine" matrix_postgres_docker_image_latest: "{{ matrix_postgres_docker_image_v11 }}" + +# A list of extra arguments to pass to the container +matrix_postgres_container_extra_arguments: [] diff --git a/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 b/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 index 0d2b9fcf..14321efd 100644 --- a/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 +++ b/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 @@ -18,6 +18,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-postgres \ --env-file={{ matrix_postgres_base_path }}/env-postgres-server \ -v {{ matrix_postgres_data_path }}:/var/lib/postgresql/data:rw \ -v /etc/passwd:/etc/passwd:ro \ + {% for arg in matrix_postgres_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_postgres_docker_image_to_use }} ExecStop=-/usr/bin/docker stop matrix-postgres ExecStop=-/usr/bin/docker rm matrix-postgres diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index e17663b0..10c5773a 100644 --- a/roles/matrix-riot-web/defaults/main.yml +++ b/roles/matrix-riot-web/defaults/main.yml @@ -6,6 +6,9 @@ matrix_riot_web_data_path: "{{ matrix_base_data_path }}/riot-web" matrix_riot_web_container_expose_port: false +# A list of extra arguments to pass to the container +matrix_riot_web_container_extra_arguments: [] + # List of systemd services that matrix-riot-web.service depends on matrix_riot_web_systemd_required_services_list: ['docker.service'] diff --git a/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 b/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 index 06f60cc5..a270e0e3 100644 --- a/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 +++ b/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 @@ -26,6 +26,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-riot-web \ -v {{ matrix_riot_web_data_path }}/home.html:/etc/riot-web/home.html:ro \ {% endif %} -v {{ matrix_riot_web_data_path }}/welcome.html:/etc/riot-web/welcome.html:ro \ + {% for arg in matrix_riot_web_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_riot_web_docker_image }} ExecStop=-/usr/bin/docker kill matrix-riot-web ExecStop=-/usr/bin/docker rm matrix-riot-web diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index ee454b5a..56e81d02 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -24,6 +24,9 @@ matrix_appservice_discord_container_expose_client_server_api_port: false # Controls whether the matrix-synapse container exposes the metrics port (tcp/9100). matrix_synapse_container_expose_metrics_port: false +# A list of extra arguments to pass to the container +matrix_synapse_container_extra_arguments: [] + # List of systemd services that matrix-synapse.service depends on matrix_synapse_systemd_required_services_list: ['docker.service'] diff --git a/roles/matrix-synapse/templates/synapse/systemd/matrix-synapse.service.j2 b/roles/matrix-synapse/templates/synapse/systemd/matrix-synapse.service.j2 index fe8d0c8a..2470256c 100644 --- a/roles/matrix-synapse/templates/synapse/systemd/matrix-synapse.service.j2 +++ b/roles/matrix-synapse/templates/synapse/systemd/matrix-synapse.service.j2 @@ -46,6 +46,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-synapse \ {% for volume in matrix_synapse_container_additional_volumes %} -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \ {% endfor %} + {% for arg in matrix_synapse_container_extra_arguments %} + {{ arg }} \ + {% endfor %} {{ matrix_synapse_docker_image }} \ -m synapse.app.homeserver -c /data/homeserver.yaml