mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-11-06 02:37:31 +01:00
Fix some ansible-lint-reported warnings
This commit is contained in:
parent
0259a7a50b
commit
89648cf58e
@ -134,7 +134,7 @@ matrix_host_command_openssl: "/usr/bin/env openssl"
|
||||
matrix_host_command_systemctl: "/usr/bin/env systemctl"
|
||||
matrix_host_command_sh: "/usr/bin/env sh"
|
||||
|
||||
matrix_ntpd_package: "{{ 'systemd-timesyncd' if (ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 7) or (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version | int > 18) else ( 'systemd' if ansible_os_family == 'Suse' else 'ntp' ) }}"
|
||||
matrix_ntpd_package: "{{ 'systemd-timesyncd' if (ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 7) or (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version | int > 18) else ('systemd' if ansible_os_family == 'Suse' else 'ntp') }}"
|
||||
matrix_ntpd_service: "{{ 'systemd-timesyncd' if (ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 7) or (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version | int > 18) or ansible_distribution == 'Archlinux' or ansible_os_family == 'Suse' else ('ntpd' if ansible_os_family == 'RedHat' else 'ntp') }}"
|
||||
|
||||
matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}"
|
||||
|
@ -36,6 +36,6 @@
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- "{{ matrix_docker_package_name }}"
|
||||
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"
|
||||
- "python{{ '3' if ansible_python.version.major == 3 else '' }}-docker"
|
||||
state: present
|
||||
when: matrix_docker_installation_enabled | bool
|
||||
|
@ -35,7 +35,7 @@
|
||||
+
|
||||
[matrix_bot_maubot_matrix_nginx_proxy_configuration]
|
||||
}}
|
||||
when: matrix_bot_maubot_proxy_management_interface|bool
|
||||
when: matrix_bot_maubot_proxy_management_interface | bool
|
||||
|
||||
- name: Warn about reverse-proxying if matrix-nginx-proxy not used
|
||||
ansible.builtin.debug:
|
||||
|
@ -12,18 +12,18 @@
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_bot_maubot_service_stat.stat.exists|bool"
|
||||
when: "matrix_bot_maubot_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure matrix-bot-maubot.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-bot-maubot.service"
|
||||
state: absent
|
||||
when: "matrix_bot_maubot_service_stat.stat.exists|bool"
|
||||
when: "matrix_bot_maubot_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-bot-maubot.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_bot_maubot_service_stat.stat.exists|bool"
|
||||
when: "matrix_bot_maubot_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure Matrix maubot paths don't exist
|
||||
ansible.builtin.file:
|
||||
|
@ -23,7 +23,7 @@
|
||||
You need to define one or more servers by either using `matrix_appservice_irc_ircService_servers`
|
||||
or by extending the base configuration with additional configuration in `matrix_appservice_irc_configuration_extension_yaml`.
|
||||
Overriding the whole bridge's configuration (`matrix_appservice_irc_configuration`) is yet another possibility.
|
||||
when: "matrix_appservice_irc_configuration.ircService.servers|length == 0"
|
||||
when: "matrix_appservice_irc_configuration.ircService.servers | length == 0"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed appservice-irc variables
|
||||
ansible.builtin.fail:
|
||||
|
@ -86,10 +86,6 @@ matrix_mautrix_whatsapp_login_shared_secret: ''
|
||||
matrix_mautrix_whatsapp_bridge_login_shared_secret_map:
|
||||
"{{ {matrix_mautrix_whatsapp_homeserver_domain: matrix_mautrix_whatsapp_login_shared_secret} if matrix_mautrix_whatsapp_login_shared_secret else {} }}"
|
||||
|
||||
# Servers to always allow double puppeting from
|
||||
matrix_mautrix_whatsapp_bridge_double_puppet_server_map:
|
||||
"{{ matrix_mautrix_whatsapp_homeserver_domain : matrix_mautrix_whatsapp_homeserver_address }}"
|
||||
|
||||
# Enable End-to-bridge encryption
|
||||
matrix_mautrix_whatsapp_bridge_encryption_allow: false
|
||||
matrix_mautrix_whatsapp_bridge_encryption_default: "{{ matrix_mautrix_whatsapp_bridge_encryption_allow }}"
|
||||
|
@ -4,4 +4,4 @@
|
||||
- ansible.builtin.debug:
|
||||
msg: ""
|
||||
with_items: "{{ matrix_playbook_runtime_results }}"
|
||||
when: "matrix_playbook_runtime_results is defined and matrix_playbook_runtime_results|length > 0"
|
||||
when: "matrix_playbook_runtime_results is defined and matrix_playbook_runtime_results | length > 0"
|
||||
|
@ -49,8 +49,8 @@
|
||||
See `roles/matrix-common-after/defaults/main.yml` for more details about that.
|
||||
with_items: "{{ matrix_systemd_services_list }}"
|
||||
when:
|
||||
- "item.endswith('.service') and (ansible_facts.services[item]|default(none) is none or ansible_facts.services[item].state != 'running')"
|
||||
when: " ansible_distribution != 'Archlinux'"
|
||||
- "item.endswith('.service') and (ansible_facts.services[item] | default(none) is none or ansible_facts.services[item].state != 'running')"
|
||||
when: "ansible_distribution != 'Archlinux'"
|
||||
|
||||
- block:
|
||||
# Currently there is a bug in ansible that renders is incompatible with systemd.
|
||||
|
@ -4,7 +4,7 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define at least one configuration in `matrix_dynamic_dns_domain_configurations` for using matrix-dynamic-dns.
|
||||
when: "matrix_dynamic_dns_domain_configurations|length == 0"
|
||||
when: "matrix_dynamic_dns_domain_configurations | length == 0"
|
||||
|
||||
- name: Fail if required settings not defined in configuration blocks
|
||||
ansible.builtin.fail:
|
||||
|
@ -4,4 +4,4 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >
|
||||
You need to define at least one mapping in `matrix_email2matrix_matrix_mappings` for enabling Email2Matrix.
|
||||
when: "matrix_email2matrix_matrix_mappings|length == 0"
|
||||
when: "matrix_email2matrix_matrix_mappings | length == 0"
|
||||
|
@ -633,7 +633,7 @@ matrix_nginx_proxy_synapse_user_dir_locations: []
|
||||
|
||||
# synapse content caching
|
||||
matrix_nginx_proxy_synapse_cache_enabled: false
|
||||
matrix_nginx_proxy_synapse_cache_path: "{{ '/tmp/synapse-cache' if matrix_nginx_proxy_enabled else matrix_nginx_proxy_data_path+'/synapse-cache' }}"
|
||||
matrix_nginx_proxy_synapse_cache_path: "{{ '/tmp/synapse-cache' if matrix_nginx_proxy_enabled else matrix_nginx_proxy_data_path + '/synapse-cache' }}"
|
||||
matrix_nginx_proxy_synapse_cache_keys_zone_name: "STATIC"
|
||||
matrix_nginx_proxy_synapse_cache_keys_zone_size: "10m"
|
||||
matrix_nginx_proxy_synapse_cache_inactive_time: "48h"
|
||||
|
@ -157,7 +157,7 @@
|
||||
register: matrix_postgres_migrate_db_to_postgres_additional_queries_result
|
||||
changed_when: matrix_postgres_migrate_db_to_postgres_additional_queries_result.rc == 0
|
||||
|
||||
when: "matrix_postgres_db_migration_request.additional_psql_statements_list | default([])|length > 0"
|
||||
when: "matrix_postgres_db_migration_request.additional_psql_statements_list | default([]) | length > 0"
|
||||
|
||||
- name: Archive {{ matrix_postgres_db_migration_request.engine_old }} database ({{ matrix_postgres_db_migration_request.src }} -> {{ matrix_postgres_db_migration_request.src }}.backup)
|
||||
ansible.builtin.command:
|
||||
|
@ -36,4 +36,4 @@
|
||||
- name: Fail if Postgres password length exceeded
|
||||
ansible.builtin.fail:
|
||||
msg: "The maximum `matrix_postgres_connection_password` length is 99 characters"
|
||||
when: "matrix_postgres_connection_password|length > 99"
|
||||
when: "matrix_postgres_connection_password | length > 99"
|
||||
|
@ -4,4 +4,4 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Enabling Sygnal requires that you specify at least one app in `matrix_sygnal_apps`
|
||||
when: "matrix_sygnal_enabled and matrix_sygnal_apps|length == 0"
|
||||
when: "matrix_sygnal_enabled and matrix_sygnal_apps | length == 0"
|
||||
|
@ -3,7 +3,7 @@
|
||||
- name: Fail if Synapse Simple Antispam blocked homeservers is not set
|
||||
ansible.builtin.fail:
|
||||
msg: "Synapse Simple Antispam is enabled, but no blocked homeservers have been set in matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers"
|
||||
when: "matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers|length == 0"
|
||||
when: "matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers | length == 0"
|
||||
|
||||
- name: Ensure git installed (RedHat)
|
||||
ansible.builtin.yum:
|
||||
|
@ -9,7 +9,7 @@
|
||||
# Unless `matrix_synapse_workers_enabled_list` is explicitly defined,
|
||||
# we'll generate it dynamically.
|
||||
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/init.yml"
|
||||
when: "matrix_synapse_enabled and matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list|length == 0"
|
||||
when: "matrix_synapse_enabled and matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list | length == 0"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse.service'] }}"
|
||||
@ -73,7 +73,7 @@
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
when: matrix_synapse_workers_enabled_list|length > 0
|
||||
when: matrix_synapse_workers_enabled_list | length > 0
|
||||
|
||||
- name: Register synapse worker metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/worker)
|
||||
ansible.builtin.set_fact:
|
||||
@ -83,5 +83,5 @@
|
||||
+
|
||||
[matrix_synapse_worker_nginx_metrics_configuration_block]
|
||||
}}
|
||||
when: matrix_synapse_workers_enabled_list|length > 0
|
||||
when: matrix_synapse_workers_enabled_list | length > 0
|
||||
when: matrix_synapse_enabled | bool and matrix_synapse_metrics_proxying_enabled | bool
|
||||
|
@ -28,6 +28,6 @@
|
||||
when: "start_result.changed"
|
||||
|
||||
- name: Register user
|
||||
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username|quote }} {{ password|quote }} {{ '1' if admin == 'yes' else '0' }}"
|
||||
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}"
|
||||
register: matrix_synapse_register_user_result
|
||||
changed_when: matrix_synapse_register_user_result.rc == 0
|
||||
|
@ -92,7 +92,7 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Expecting 4 lines in the "find rooms" result.
|
||||
when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.failed or matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines|length != 4"
|
||||
when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.failed or matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines | length != 4"
|
||||
|
||||
- block:
|
||||
# matrix_synapse_rust_synapse_compress_state_eligible_rooms is a list
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
- name: Populate matrix_synapse_stream_writers from enabled stream writer workers list
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_stream_writers: "{{ matrix_synapse_stream_writers | combine ({item.ansible_facts.worker.stream_writer_stream: [item.ansible_facts.worker.name]}) }}"
|
||||
matrix_synapse_stream_writers: "{{ matrix_synapse_stream_writers | combine({item.ansible_facts.worker.stream_writer_stream: [item.ansible_facts.worker.name]}) }}"
|
||||
with_items: "{{ matrix_synapse_workers_list_results_stream_writer_workers.results }}"
|
||||
|
||||
- name: Build federation sender workers
|
||||
|
@ -42,7 +42,7 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Synapse stream_writer workers (such as {{ item }}) need to define a valid `stream_writer_stream` property
|
||||
(not `{{ matrix_synapse_worker_details.stream_writer_stream|default('undefined') }}`).
|
||||
(not `{{ matrix_synapse_worker_details.stream_writer_stream | default('undefined') }}`).
|
||||
Supported types are: {{ matrix_synapse_workers_known_stream_writer_stream_types | join(', ') }}
|
||||
when: "'stream_writer_stream' not in matrix_synapse_worker_details or matrix_synapse_worker_details.stream_writer_stream not in matrix_synapse_workers_known_stream_writer_stream_types"
|
||||
|
||||
|
@ -36,11 +36,11 @@
|
||||
when: "start_result.changed or postgres_start_result.changed"
|
||||
|
||||
- name: Generate password hash
|
||||
ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password|quote }}"
|
||||
ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password | quote }}"
|
||||
register: password_hash
|
||||
changed_when: false
|
||||
|
||||
- name: Update user password hash
|
||||
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash {{ username|quote }} {{ password_hash.stdout|quote }}"
|
||||
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash {{ username | quote }} {{ password_hash.stdout | quote }}"
|
||||
register: matrix_synapse_update_user_password_result
|
||||
changed_when: matrix_synapse_update_user_password_result.rc == 0
|
||||
|
@ -16,7 +16,7 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
`{{ item }}` cannot be more than 1. This is a single-instance worker.
|
||||
when: "vars[item]|int > 1"
|
||||
when: "vars[item] | int > 1"
|
||||
with_items:
|
||||
- "matrix_synapse_workers_appservice_workers_count"
|
||||
- "matrix_synapse_workers_user_dir_workers_count"
|
||||
|
Loading…
Reference in New Issue
Block a user