fix: all praise the allmighty yamllinter
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
---
|
||||
# matrix-registration is a simple python application to have a token based matrix registration
|
||||
# See: https://zeratax.github.io/matrix-registration/
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
---
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
fail:
|
||||
msg: "The `one_time` variable needs to be provided to this playbook, via --extra-vars"
|
||||
@ -23,7 +25,7 @@
|
||||
"one_time": {{ 'true' if one_time == 'yes' else 'false' }},
|
||||
"ex_date": {{ ex_date|to_json }}
|
||||
}
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
register: matrix_registration_api_result
|
||||
|
||||
- set_fact:
|
||||
@ -37,7 +39,7 @@
|
||||
Full token details are:
|
||||
|
||||
{{ matrix_registration_api_result.json }}
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: Inject result message into matrix_playbook_runtime_results
|
||||
set_fact:
|
||||
@ -47,4 +49,4 @@
|
||||
+
|
||||
[matrix_registration_api_result_message]
|
||||
}}
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
@ -1,3 +1,4 @@
|
||||
---
|
||||
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
|
||||
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
|
||||
- name: Fail if trying to self-build on Ansible < 2.8
|
||||
@ -10,49 +11,49 @@
|
||||
when: matrix_registration_enabled|bool
|
||||
|
||||
- block:
|
||||
- name: Fail if matrix-nginx-proxy role already executed
|
||||
fail:
|
||||
msg: >-
|
||||
Trying to append matrix-registration's reverse-proxying configuration to matrix-nginx-proxy,
|
||||
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
|
||||
- name: Fail if matrix-nginx-proxy role already executed
|
||||
fail:
|
||||
msg: >-
|
||||
Trying to append matrix-registration's reverse-proxying configuration to matrix-nginx-proxy,
|
||||
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
|
||||
|
||||
- name: Generate matrix-registration proxying configuration for matrix-nginx-proxy
|
||||
set_fact:
|
||||
matrix_registration_matrix_nginx_proxy_configuration: |
|
||||
rewrite ^{{ matrix_registration_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/ permanent;
|
||||
rewrite ^{{ matrix_registration_public_endpoint }}/$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/register redirect;
|
||||
- name: Generate matrix-registration proxying configuration for matrix-nginx-proxy
|
||||
set_fact:
|
||||
matrix_registration_matrix_nginx_proxy_configuration: |
|
||||
rewrite ^{{ matrix_registration_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/ permanent;
|
||||
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) %}
|
||||
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||
resolver 127.0.0.11 valid=5s;
|
||||
set $backend "matrix-registration:5000";
|
||||
proxy_pass http://$backend/$1;
|
||||
{% else %}
|
||||
{# Generic configuration for use outside of our container setup #}
|
||||
proxy_pass http://127.0.0.1:8767/$1;
|
||||
{% endif %}
|
||||
location ~ ^{{ matrix_registration_public_endpoint }}/(.*) {
|
||||
{% 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";
|
||||
proxy_pass http://$backend/$1;
|
||||
{% else %}
|
||||
{# Generic configuration for use outside of our container setup #}
|
||||
proxy_pass http://127.0.0.1:8767/$1;
|
||||
{% endif %}
|
||||
|
||||
{#
|
||||
Workaround matrix-registration serving the background image at /static
|
||||
(see https://github.com/ZerataX/matrix-registration/issues/47)
|
||||
#}
|
||||
sub_filter_once off;
|
||||
sub_filter_types text/css;
|
||||
sub_filter "/static/" "{{ matrix_registration_public_endpoint }}/static/";
|
||||
}
|
||||
{#
|
||||
Workaround matrix-registration serving the background image at /static
|
||||
(see https://github.com/ZerataX/matrix-registration/issues/47)
|
||||
#}
|
||||
sub_filter_once off;
|
||||
sub_filter_types text/css;
|
||||
sub_filter "/static/" "{{ matrix_registration_public_endpoint }}/static/";
|
||||
}
|
||||
|
||||
- name: Register matrix-registration proxying configuration with matrix-nginx-proxy
|
||||
set_fact:
|
||||
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
|
||||
{{
|
||||
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
|
||||
+
|
||||
[matrix_registration_matrix_nginx_proxy_configuration]
|
||||
}}
|
||||
- name: Register matrix-registration proxying configuration with matrix-nginx-proxy
|
||||
set_fact:
|
||||
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
|
||||
{{
|
||||
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
|
||||
+
|
||||
[matrix_registration_matrix_nginx_proxy_configuration]
|
||||
}}
|
||||
tags:
|
||||
- always
|
||||
when: matrix_registration_enabled|bool
|
||||
|
@ -1,3 +1,5 @@
|
||||
---
|
||||
|
||||
- name: Call matrix-registration list all tokens API
|
||||
uri:
|
||||
url: "{{ matrix_registration_api_token_endpoint }}"
|
||||
@ -8,7 +10,7 @@
|
||||
Authorization: "SharedSecret {{ matrix_registration_admin_secret }}"
|
||||
method: GET
|
||||
body_format: json
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
register: matrix_registration_api_result
|
||||
|
||||
- set_fact:
|
||||
@ -16,7 +18,7 @@
|
||||
matrix-registration result:
|
||||
|
||||
{{ matrix_registration_api_result.json | to_nice_json }}
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: Inject result message into matrix_playbook_runtime_results
|
||||
set_fact:
|
||||
@ -26,4 +28,4 @@
|
||||
+
|
||||
[matrix_registration_api_result_message]
|
||||
}}
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
@ -1,3 +1,5 @@
|
||||
---
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
@ -39,10 +39,10 @@
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_registration_base_path }}", when: true }
|
||||
- { 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 }}"}
|
||||
- {path: "{{ matrix_registration_base_path }}", when: true}
|
||||
- {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"
|
||||
|
||||
- name: Ensure matrix-registration image is pulled
|
||||
@ -71,7 +71,7 @@
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_registration_docker_src_files_path }}"
|
||||
pull: yes
|
||||
pull: true
|
||||
when: "matrix_registration_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure matrix-registration config installed
|
||||
@ -91,7 +91,7 @@
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-registration.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
daemon_reload: true
|
||||
when: "matrix_registration_systemd_service_result.changed|bool"
|
||||
|
||||
- name: Ensure matrix-registration.service restarted, if necessary
|
||||
|
@ -9,8 +9,8 @@
|
||||
service:
|
||||
name: matrix-registration
|
||||
state: stopped
|
||||
enabled: no
|
||||
daemon_reload: yes
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_registration_service_stat.stat.exists|bool"
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-registration.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
daemon_reload: true
|
||||
when: "matrix_registration_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure matrix-registration Docker image doesn't exist
|
||||
|
Reference in New Issue
Block a user