More ansible-lint fixes
This commit is contained in:
@ -23,7 +23,7 @@
|
||||
body: |
|
||||
{
|
||||
"one_time": {{ 'true' if one_time == 'yes' else 'false' }},
|
||||
"ex_date": {{ ex_date|to_json }}
|
||||
"ex_date": {{ ex_date | to_json }}
|
||||
}
|
||||
check_mode: false
|
||||
register: matrix_registration_api_result
|
||||
@ -45,7 +45,7 @@
|
||||
ansible.builtin.set_fact:
|
||||
matrix_playbook_runtime_results: |
|
||||
{{
|
||||
matrix_playbook_runtime_results|default([])
|
||||
matrix_playbook_runtime_results | default([])
|
||||
+
|
||||
[matrix_registration_api_result_message]
|
||||
}}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-registration.service'] }}"
|
||||
when: matrix_registration_enabled|bool
|
||||
when: matrix_registration_enabled | bool
|
||||
|
||||
- block:
|
||||
- name: Fail if matrix-nginx-proxy role already executed
|
||||
@ -18,7 +18,7 @@
|
||||
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-registration role.
|
||||
when: matrix_nginx_proxy_role_executed|default(False)|bool
|
||||
when: matrix_nginx_proxy_role_executed | default(False) | bool
|
||||
|
||||
- name: Generate matrix-registration proxying configuration for matrix-nginx-proxy
|
||||
ansible.builtin.set_fact:
|
||||
@ -27,7 +27,7 @@
|
||||
rewrite ^{{ matrix_registration_public_endpoint }}/$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/register redirect;
|
||||
|
||||
location ~ ^{{ matrix_registration_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-registration:5000";
|
||||
@ -50,13 +50,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_registration_matrix_nginx_proxy_configuration]
|
||||
}}
|
||||
tags:
|
||||
- always
|
||||
when: matrix_registration_enabled|bool
|
||||
when: matrix_registration_enabled | bool
|
||||
|
||||
- name: Warn about reverse-proxying if matrix-nginx-proxy not used
|
||||
ansible.builtin.debug:
|
||||
@ -66,4 +66,4 @@
|
||||
Please make sure that you're proxying the `{{ matrix_registration_public_endpoint }}`
|
||||
URL endpoint to the matrix-registration container.
|
||||
You can expose the container's port using the `matrix_registration_container_http_host_bind_port` variable.
|
||||
when: "matrix_registration_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool"
|
||||
when: "matrix_registration_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool"
|
||||
|
@ -24,7 +24,7 @@
|
||||
ansible.builtin.set_fact:
|
||||
matrix_playbook_runtime_results: |
|
||||
{{
|
||||
matrix_playbook_runtime_results|default([])
|
||||
matrix_playbook_runtime_results | default([])
|
||||
+
|
||||
[matrix_registration_api_result_message]
|
||||
}}
|
||||
|
@ -1,33 +1,33 @@
|
||||
---
|
||||
|
||||
- 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_registration_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup | bool and matrix_registration_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-matrix-registration
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup|bool and matrix_registration_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup | bool and matrix_registration_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-matrix-registration
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup|bool and not matrix_registration_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup | bool and not matrix_registration_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-matrix-registration
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/generate_token.yml"
|
||||
when: "run_setup|bool and matrix_registration_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/generate_token.yml"
|
||||
when: "run_setup | bool and matrix_registration_enabled | bool"
|
||||
tags:
|
||||
- generate-matrix-registration-token
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/list_tokens.yml"
|
||||
when: "run_setup|bool and matrix_registration_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/list_tokens.yml"
|
||||
when: "run_setup | bool and matrix_registration_enabled | bool"
|
||||
tags:
|
||||
- list-matrix-registration-tokens
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_registration_sqlite_database_path_local }}"
|
||||
register: matrix_registration_sqlite_database_path_local_stat_result
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_registration_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_registration_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
caller: "{{ role_path | basename }}"
|
||||
engine_variable_name: 'matrix_registration_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-registration.service']
|
||||
@ -24,11 +24,11 @@
|
||||
- ALTER TABLE tokens ALTER COLUMN ex_date TYPE TIMESTAMP WITHOUT TIME ZONE;
|
||||
additional_psql_statements_db_name: "{{ matrix_registration_database_name }}"
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_registration_requires_restart: true
|
||||
when: "matrix_registration_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_registration_sqlite_database_path_local_stat_result.stat.exists | bool"
|
||||
when: "matrix_registration_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure matrix-registration paths exist
|
||||
@ -43,7 +43,7 @@
|
||||
- {path: "{{ matrix_registration_config_path }}", when: true}
|
||||
- {path: "{{ matrix_registration_data_path }}", when: true}
|
||||
- {path: "{{ matrix_registration_docker_src_files_path }}", when: "{{ matrix_registration_container_image_self_build }}"}
|
||||
when: "item.when|bool"
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure matrix-registration image is pulled
|
||||
docker_image:
|
||||
@ -51,7 +51,7 @@
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_registration_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_registration_docker_image_force_pull }}"
|
||||
when: "not matrix_registration_container_image_self_build|bool"
|
||||
when: "not matrix_registration_container_image_self_build | bool"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
@ -66,7 +66,7 @@
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_registration_git_pull_results
|
||||
when: "matrix_registration_container_image_self_build|bool"
|
||||
when: "matrix_registration_container_image_self_build | bool"
|
||||
|
||||
# See: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1864
|
||||
- name: Patch setup.py to allow self-built version to work
|
||||
@ -74,7 +74,7 @@
|
||||
path: "{{ matrix_registration_docker_src_files_path }}/setup.py"
|
||||
regexp: 'flask-limiter'
|
||||
line: '"flask-limiter~=1.1.0", "Markupsafe<2.1",'
|
||||
when: "matrix_registration_container_image_self_build|bool and matrix_registration_container_image_self_build_python_dependencies_patch_enabled|bool"
|
||||
when: "matrix_registration_container_image_self_build | bool and matrix_registration_container_image_self_build_python_dependencies_patch_enabled | bool"
|
||||
|
||||
- name: Ensure matrix-registration Docker image is built
|
||||
docker_image:
|
||||
@ -86,11 +86,11 @@
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_registration_docker_src_files_path }}"
|
||||
pull: true
|
||||
when: "matrix_registration_container_image_self_build|bool"
|
||||
when: "matrix_registration_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure matrix-registration config installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_registration_configuration|to_nice_yaml(indent=2, width=999999) }}"
|
||||
content: "{{ matrix_registration_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_registration_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
@ -106,10 +106,10 @@
|
||||
- name: Ensure systemd reloaded after matrix-registration.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_registration_systemd_service_result.changed|bool"
|
||||
when: "matrix_registration_systemd_service_result.changed | bool"
|
||||
|
||||
- name: Ensure matrix-registration.service restarted, if necessary
|
||||
ansible.builtin.service:
|
||||
name: "matrix-registration.service"
|
||||
state: restarted
|
||||
when: "matrix_registration_requires_restart|bool"
|
||||
when: "matrix_registration_requires_restart | bool"
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-registration service
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-registration.service"
|
||||
register: matrix_registration_service_stat
|
||||
|
||||
@ -12,18 +12,18 @@
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_registration_service_stat.stat.exists|bool"
|
||||
when: "matrix_registration_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure matrix-registration.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-registration.service"
|
||||
state: absent
|
||||
when: "matrix_registration_service_stat.stat.exists|bool"
|
||||
when: "matrix_registration_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-registration.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_registration_service_stat.stat.exists|bool"
|
||||
when: "matrix_registration_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure matrix-registration Docker image doesn't exist
|
||||
docker_image:
|
||||
|
Reference in New Issue
Block a user