1
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2025-08-04 21:43:06 +02:00

Explicitly tell template-lookup to not auto-parse JSON files

ansible-core>=2.19.0 only auto-parses YAML files, not JSON.

Previous ansible-core versions auto-parsed JSON as well, but ansible-core>=2.19.0
doesn't, so we added a `from_json` post-filter.
However, older versions auto-parsing JSON and turning it into a dict, on
which we later run `from_json` is no good.

In this patch, we try to equalize behavior and configure Ansible to never parse JSON,
hopefully making old-Ansible behave like new Ansible.

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/4458

Ref: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_lookup.html#parameter-convert_data
This commit is contained in:
Slavi Pantaleev
2025-07-27 07:42:54 +03:00
parent 4ef78bdb7f
commit d876da4186
7 changed files with 11 additions and 11 deletions

View File

@ -182,7 +182,7 @@ matrix_appservice_kakaotalk_configuration: "{{ matrix_appservice_kakaotalk_confi
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_appservice_kakaotalk_node_configuration_default: "{{ lookup('template', 'templates/node-config.json.j2') | from_json }}" matrix_appservice_kakaotalk_node_configuration_default: "{{ lookup('template', 'templates/node-config.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for appservice-kakaotalk-node should go to `matrix_appservice_kakaotalk_node_configuration_extension_json`. # Your custom JSON configuration for appservice-kakaotalk-node should go to `matrix_appservice_kakaotalk_node_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_appservice_kakaotalk_node_configuration_default`). # This configuration extends the default starting configuration (`matrix_appservice_kakaotalk_node_configuration_default`).

View File

@ -188,7 +188,7 @@ matrix_client_cinny_config_featuredCommunities_openAsDefault: false # noqa var-
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_client_cinny_configuration_default: "{{ lookup('template', 'templates/config.json.j2') | from_json }}" matrix_client_cinny_configuration_default: "{{ lookup('template', 'templates/config.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for Cinny should go to `matrix_client_cinny_configuration_extension_json`. # Your custom JSON configuration for Cinny should go to `matrix_client_cinny_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_client_cinny_configuration_default`). # This configuration extends the default starting configuration (`matrix_client_cinny_configuration_default`).

View File

@ -320,7 +320,7 @@ matrix_client_element_setting_defaults_custom_themes: [] # noqa var-naming
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_client_element_configuration_default: "{{ lookup('template', 'templates/config.json.j2') | from_json }}" matrix_client_element_configuration_default: "{{ lookup('template', 'templates/config.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for Element Web should go to `matrix_client_element_configuration_extension_json`. # Your custom JSON configuration for Element Web should go to `matrix_client_element_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_client_element_configuration_default`). # This configuration extends the default starting configuration (`matrix_client_element_configuration_default`).
@ -358,7 +358,7 @@ matrix_client_element_location_sharing_enabled: false
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_client_element_location_sharing_map_style_default: "{{ lookup('template', 'templates/map_style.json.j2') | from_json }}" matrix_client_element_location_sharing_map_style_default: "{{ lookup('template', 'templates/map_style.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for Element location sharing map style should go to `matrix_client_element_location_sharing_map_style_extension_json`. # Your custom JSON configuration for Element location sharing map style should go to `matrix_client_element_location_sharing_map_style_extension_json`.
# This configuration extends the default starting configuration (`matrix_client_element_location_sharing_map_style_default`). # This configuration extends the default starting configuration (`matrix_client_element_location_sharing_map_style_default`).

View File

@ -170,7 +170,7 @@ matrix_client_hydrogen_bugReportEndpointUrl: "https://element.io/bugreports/subm
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_client_hydrogen_configuration_default: "{{ lookup('template', 'templates/config.json.j2') | from_json }}" matrix_client_hydrogen_configuration_default: "{{ lookup('template', 'templates/config.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for Hydrogen should go to `matrix_client_hydrogen_configuration_extension_json`. # Your custom JSON configuration for Hydrogen should go to `matrix_client_hydrogen_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_client_hydrogen_configuration_default`). # This configuration extends the default starting configuration (`matrix_client_hydrogen_configuration_default`).

View File

@ -231,7 +231,7 @@ matrix_client_schildichat_setting_defaults_custom_themes: [] # noqa var-naming
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_client_schildichat_configuration_default: "{{ lookup('template', 'templates/config.json.j2') | from_json }}" matrix_client_schildichat_configuration_default: "{{ lookup('template', 'templates/config.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for SchildiChat Web should go to `matrix_client_schildichat_configuration_extension_json`. # Your custom JSON configuration for SchildiChat Web should go to `matrix_client_schildichat_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_client_schildichat_configuration_default`). # This configuration extends the default starting configuration (`matrix_client_schildichat_configuration_default`).
@ -269,7 +269,7 @@ matrix_client_schildichat_location_sharing_enabled: false
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_client_schildichat_location_sharing_map_style_default: "{{ lookup('template', 'templates/map_style.json.j2') | from_json }}" matrix_client_schildichat_location_sharing_map_style_default: "{{ lookup('template', 'templates/map_style.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for SchildiChat location sharing map style should go to `matrix_client_schildichat_location_sharing_map_style_extension_json`. # Your custom JSON configuration for SchildiChat location sharing map style should go to `matrix_client_schildichat_location_sharing_map_style_extension_json`.
# This configuration extends the default starting configuration (`matrix_client_schildichat_location_sharing_map_style_default`). # This configuration extends the default starting configuration (`matrix_client_schildichat_location_sharing_map_style_default`).

View File

@ -152,7 +152,7 @@ matrix_corporal_debug: false
# #
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
# This is unlike what it does when looking up YAML template files (no automatic parsing there). # This is unlike what it does when looking up YAML template files (no automatic parsing there).
matrix_corporal_configuration_default: "{{ lookup('template', 'templates/config.json.j2') | from_json }}" matrix_corporal_configuration_default: "{{ lookup('template', 'templates/config.json.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for Corporal should go to `matrix_corporal_configuration_extension_json`. # Your custom JSON configuration for Corporal should go to `matrix_corporal_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_corporal_configuration_default`). # This configuration extends the default starting configuration (`matrix_corporal_configuration_default`).

View File

@ -227,7 +227,7 @@ matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_cust
# #
# For a more advanced customization, you can extend the default (see `matrix_static_files_file_matrix_client_configuration_extension_json`) # For a more advanced customization, you can extend the default (see `matrix_static_files_file_matrix_client_configuration_extension_json`)
# or completely replace this variable with your own template. # or completely replace this variable with your own template.
matrix_static_files_file_matrix_client_configuration_json: "{{ lookup('template', 'templates/public/.well-known/matrix/client.j2') | from_json }}" matrix_static_files_file_matrix_client_configuration_json: "{{ lookup('template', 'templates/public/.well-known/matrix/client.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for /.well-known/matrix/client should go to `matrix_static_files_file_matrix_client_configuration_extension_json`. # Your custom JSON configuration for /.well-known/matrix/client should go to `matrix_static_files_file_matrix_client_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_static_files_file_matrix_client_configuration_extension_json`). # This configuration extends the default starting configuration (`matrix_static_files_file_matrix_client_configuration_extension_json`).
@ -281,7 +281,7 @@ matrix_static_files_file_matrix_server_property_m_server: ''
# #
# For a more advanced customization, you can extend the default (see `matrix_static_files_file_matrix_server_configuration_extension_json`) # For a more advanced customization, you can extend the default (see `matrix_static_files_file_matrix_server_configuration_extension_json`)
# or completely replace this variable with your own template. # or completely replace this variable with your own template.
matrix_static_files_file_matrix_server_configuration_json: "{{ lookup('template', 'templates/public/.well-known/matrix/server.j2') | from_json }}" matrix_static_files_file_matrix_server_configuration_json: "{{ lookup('template', 'templates/public/.well-known/matrix/server.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for /.well-known/matrix/server should go to `matrix_static_files_file_matrix_server_configuration_extension_json`. # Your custom JSON configuration for /.well-known/matrix/server should go to `matrix_static_files_file_matrix_server_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_static_files_file_matrix_server_configuration_extension_json`). # This configuration extends the default starting configuration (`matrix_static_files_file_matrix_server_configuration_extension_json`).
@ -337,7 +337,7 @@ matrix_static_files_file_matrix_support_property_m_support_page: ""
# #
# For a more advanced customization, you can extend the default (see `matrix_static_files_file_matrix_support_configuration_extension_json`) # For a more advanced customization, you can extend the default (see `matrix_static_files_file_matrix_support_configuration_extension_json`)
# or completely replace this variable with your own template. # or completely replace this variable with your own template.
matrix_static_files_file_matrix_support_configuration_json: "{{ lookup('template', 'templates/public/.well-known/matrix/support.j2') | from_json }}" matrix_static_files_file_matrix_support_configuration_json: "{{ lookup('template', 'templates/public/.well-known/matrix/support.j2', convert_data=False) | from_json }}"
# Your custom JSON configuration for /.well-known/matrix/support should go to `matrix_static_files_file_matrix_support_configuration_extension_json`. # Your custom JSON configuration for /.well-known/matrix/support should go to `matrix_static_files_file_matrix_support_configuration_extension_json`.
# This configuration extends the default starting configuration (`matrix_static_files_file_matrix_support_configuration_extension_json`). # This configuration extends the default starting configuration (`matrix_static_files_file_matrix_support_configuration_extension_json`).