More ansible-lint fixes
This commit is contained in:
@ -12,28 +12,28 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
when: "matrix_synapse_role_executed | default(False)"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-slack.service'] }}"
|
||||
when: matrix_appservice_slack_enabled|bool
|
||||
when: matrix_appservice_slack_enabled | bool
|
||||
|
||||
# If the matrix-synapse role is not used, these variables may not exist.
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{
|
||||
matrix_synapse_container_extra_arguments|default([])
|
||||
matrix_synapse_container_extra_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_appservice_slack_config_path }}/slack-registration.yaml,dst=/matrix-appservice-slack-registration.yaml,ro"]
|
||||
}}
|
||||
|
||||
matrix_synapse_app_service_config_files: >
|
||||
{{
|
||||
matrix_synapse_app_service_config_files|default([])
|
||||
matrix_synapse_app_service_config_files | default([])
|
||||
+
|
||||
["/matrix-appservice-slack-registration.yaml"]
|
||||
}}
|
||||
when: matrix_appservice_slack_enabled|bool
|
||||
when: matrix_appservice_slack_enabled | bool
|
||||
|
||||
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
|
||||
# We don't want to fail in such cases.
|
||||
@ -41,7 +41,7 @@
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
when: "matrix_synapse_role_executed | default(False)"
|
||||
|
||||
- block:
|
||||
- name: Fail if matrix-nginx-proxy role already executed
|
||||
@ -51,13 +51,13 @@
|
||||
but it's pointless since the matrix-nginx-proxy role had already executed.
|
||||
To fix this, please change the order of roles in your playbook,
|
||||
so that the matrix-nginx-proxy role would run after the matrix-bridge-appservice-slack role.
|
||||
when: matrix_nginx_proxy_role_executed|default(False)|bool
|
||||
when: matrix_nginx_proxy_role_executed | default(False) | bool
|
||||
|
||||
- name: Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy
|
||||
ansible.builtin.set_fact:
|
||||
matrix_appservice_slack_matrix_nginx_proxy_configuration: |
|
||||
location {{ matrix_appservice_slack_public_endpoint }} {
|
||||
{% if matrix_nginx_proxy_enabled|default(False) %}
|
||||
{% if matrix_nginx_proxy_enabled | default(False) %}
|
||||
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||
resolver 127.0.0.11 valid=5s;
|
||||
set $backend "{{ matrix_appservice_slack_appservice_url }}:{{ matrix_appservice_slack_slack_port }}";
|
||||
@ -72,13 +72,13 @@
|
||||
ansible.builtin.set_fact:
|
||||
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
|
||||
{{
|
||||
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
|
||||
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([])
|
||||
+
|
||||
[matrix_appservice_slack_matrix_nginx_proxy_configuration]
|
||||
}}
|
||||
tags:
|
||||
- always
|
||||
when: matrix_appservice_slack_enabled|bool
|
||||
when: matrix_appservice_slack_enabled | bool
|
||||
|
||||
- name: Warn about reverse-proxying if matrix-nginx-proxy not used
|
||||
ansible.builtin.debug:
|
||||
@ -88,4 +88,4 @@
|
||||
Please make sure that you're proxying the `{{ something }}`
|
||||
URL endpoint to the matrix-appservice-slack container.
|
||||
You can expose the container's port using the `matrix_appservice_slack_container_http_host_bind_port` variable.
|
||||
when: "matrix_appservice_slack_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool"
|
||||
when: "matrix_appservice_slack_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool"
|
||||
|
@ -1,23 +1,23 @@
|
||||
---
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup|bool and matrix_appservice_slack_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup | bool and matrix_appservice_slack_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-appservice-slack
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup|bool and matrix_appservice_slack_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup | bool and matrix_appservice_slack_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-appservice-slack
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup|bool and not matrix_appservice_slack_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup | bool and not matrix_appservice_slack_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-appservice-slack
|
||||
|
@ -3,14 +3,14 @@
|
||||
- name: Fail if Postgres not enabled
|
||||
ansible.builtin.fail:
|
||||
msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate."
|
||||
when: "not matrix_postgres_enabled|bool"
|
||||
when: "not matrix_postgres_enabled | bool"
|
||||
|
||||
# Defaults
|
||||
|
||||
- name: Set postgres_start_wait_time, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
postgres_start_wait_time: 15
|
||||
when: "postgres_start_wait_time|default('') == ''"
|
||||
when: "postgres_start_wait_time | default('') == ''"
|
||||
|
||||
# Actual import work
|
||||
|
||||
@ -22,11 +22,11 @@
|
||||
register: matrix_postgres_service_start_result
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
wait_for:
|
||||
ansible.builtin.wait_for:
|
||||
timeout: "{{ postgres_start_wait_time }}"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "matrix_postgres_service_start_result.changed|bool"
|
||||
when: "matrix_postgres_service_start_result.changed | bool"
|
||||
|
||||
- name: Ensure matrix-appservice-slack is stopped
|
||||
ansible.builtin.service:
|
||||
@ -60,7 +60,7 @@
|
||||
ansible.builtin.set_fact:
|
||||
matrix_playbook_runtime_results: |
|
||||
{{
|
||||
matrix_playbook_runtime_results|default([])
|
||||
matrix_playbook_runtime_results | default([])
|
||||
+
|
||||
[
|
||||
"NOTE: Your appservice-slack database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_slack_data_path }}/*.db` to `{{ matrix_appservice_slack_data_path }}/*.db.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete these files."
|
||||
|
@ -12,23 +12,23 @@
|
||||
- {path: "{{ matrix_appservice_slack_config_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_slack_data_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_slack_docker_src_files_path }}", when: "{{ matrix_appservice_slack_container_image_self_build }}"}
|
||||
when: item.when|bool
|
||||
when: item.when | bool
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_appservice_slack_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if a nedb database already exists
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_appservice_slack_data_path }}/teams.db"
|
||||
register: matrix_appservice_slack_nedb_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_appservice_slack_requires_restart: true
|
||||
when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists | bool"
|
||||
when: "matrix_appservice_slack_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Appservice Slack image is pulled
|
||||
@ -37,7 +37,7 @@
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_slack_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_appservice_slack_docker_image_force_pull }}"
|
||||
when: "not matrix_appservice_slack_container_image_self_build|bool"
|
||||
when: "not matrix_appservice_slack_container_image_self_build | bool"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
@ -51,7 +51,7 @@
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_appservice_slack_git_pull_results
|
||||
when: "matrix_appservice_slack_container_image_self_build|bool"
|
||||
when: "matrix_appservice_slack_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure matrix-appservice-slack Docker image is built
|
||||
docker_image:
|
||||
@ -63,11 +63,11 @@
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_appservice_slack_docker_src_files_path }}"
|
||||
pull: true
|
||||
when: "matrix_appservice_slack_container_image_self_build|bool and matrix_appservice_slack_git_pull_results.changed"
|
||||
when: "matrix_appservice_slack_container_image_self_build | bool and matrix_appservice_slack_git_pull_results.changed"
|
||||
|
||||
- name: Ensure Matrix Appservice Slack config installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_appservice_slack_configuration|to_nice_yaml(indent=2, width=999999) }}"
|
||||
content: "{{ matrix_appservice_slack_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_appservice_slack_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
- name: Ensure appservice-slack registration.yaml installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_appservice_slack_registration|to_nice_yaml(indent=2, width=999999) }}"
|
||||
content: "{{ matrix_appservice_slack_registration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_appservice_slack_config_path }}/slack-registration.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
@ -97,4 +97,4 @@
|
||||
ansible.builtin.service:
|
||||
name: "matrix-appservice-slack.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_slack_requires_restart|bool"
|
||||
when: "matrix_appservice_slack_requires_restart | bool"
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-appservice-slack service
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-appservice-slack.service"
|
||||
register: matrix_appservice_slack_service_stat
|
||||
|
||||
|
Reference in New Issue
Block a user