Use fully-qualified module names for builtin Ansible modules

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1939
This commit is contained in:
Slavi Pantaleev
2022-07-18 10:39:08 +03:00
parent 78b5be4a26
commit 34cdaade08
297 changed files with 1420 additions and 1420 deletions

View File

@ -2,17 +2,17 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
The matrix-bridge-hookshot role needs to execute before the matrix-synapse role.
when: "matrix_hookshot_enabled and matrix_synapse_role_executed|default(False)"
- set_fact:
- ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-hookshot.service'] }}"
when: matrix_hookshot_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist.
- set_fact:
- ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: >
{{
matrix_synapse_container_extra_arguments|default([])
@ -30,7 +30,7 @@
- block:
- name: Fail if matrix-nginx-proxy role already executed
fail:
ansible.builtin.fail:
msg: >-
Trying to append hookshot's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed.
@ -39,7 +39,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Matrix hookshot proxying configuration for matrix-nginx-proxy
set_fact:
ansible.builtin.set_fact:
matrix_hookshot_matrix_nginx_proxy_configuration: |
location ~ ^{{ matrix_hookshot_appservice_endpoint }}/(.*)$ {
{% if matrix_nginx_proxy_enabled|default(False) %}
@ -95,7 +95,7 @@
}
- name: Register hookshot proxying configuration with matrix-nginx-proxy
set_fact:
ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -104,7 +104,7 @@
}}
- name: Generate hookshot metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot)
set_fact:
ansible.builtin.set_fact:
matrix_hookshot_matrix_nginx_proxy_metrics_configuration_matrix_domain: |
location /metrics/hookshot {
{% if matrix_nginx_proxy_enabled|default(False) %}
@ -120,7 +120,7 @@
when: matrix_hookshot_metrics_enabled|bool and matrix_hookshot_metrics_proxying_enabled|bool
- name: Register hookshot metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot)
set_fact:
ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([])
@ -131,7 +131,7 @@
when: matrix_hookshot_enabled|bool
- name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug:
ansible.builtin.debug:
msg: >-
NOTE: You've enabled the hookshot bridge but are not using the matrix-nginx-proxy
reverse proxy.

View File

@ -3,7 +3,7 @@
- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml"
- name: Ensure hookshot paths exist
file:
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
@ -27,7 +27,7 @@
until: result is not failed
- name: Ensure hookshot repository is present on self-build
git:
ansible.builtin.git:
repo: "{{ matrix_hookshot_container_image_self_build_repo }}"
dest: "{{ matrix_hookshot_docker_src_files_path }}"
version: "{{ matrix_hookshot_container_image_self_build_branch }}"
@ -55,13 +55,13 @@
register: hookshot_passkey_file
- name: Generate hookshot passkey if it doesn't exist
shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_hookshot_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096"
ansible.builtin.shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_hookshot_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096"
become: true
become_user: "{{ matrix_user_username }}"
when: "not hookshot_passkey_file.stat.exists"
- name: Ensure hookshot config.yml installed if provided
copy:
ansible.builtin.copy:
content: "{{ matrix_hookshot_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_hookshot_base_path }}/config.yml"
mode: 0644
@ -69,7 +69,7 @@
group: "{{ matrix_user_groupname }}"
- name: Validate hookshot config.yml
command: |
ansible.builtin.command: |
{{ matrix_host_command_docker }} run
--rm
--name={{ matrix_hookshot_container_url }}-validate
@ -80,12 +80,12 @@
register: hookshot_config_validation_result
- name: Fail if hookshot config.yml invalid
fail:
ansible.builtin.fail:
msg: "Your hookshot configuration did not pass validation:\n{{ hookshot_config_validation_result.stdout }}\n{{ hookshot_config_validation_result.stderr }}"
when: "hookshot_config_validation_result.rc > 0"
- name: Ensure hookshot registration.yml installed if provided
copy:
ansible.builtin.copy:
content: "{{ matrix_hookshot_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_hookshot_base_path }}/registration.yml"
mode: 0644
@ -93,7 +93,7 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure hookshot github private key file installed if github is enabled
copy:
ansible.builtin.copy:
content: "{{ matrix_hookshot_github_private_key }}"
dest: "{{ matrix_hookshot_base_path }}/{{ matrix_hookshot_github_private_key_file }}"
mode: 0400
@ -102,13 +102,13 @@
when: matrix_hookshot_github_enabled|bool and matrix_hookshot_github_private_key|length > 0
- name: Ensure matrix-hookshot.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-hookshot.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-hookshot.service"
mode: 0644
register: matrix_hookshot_systemd_service_result
- name: Ensure systemd reloaded after matrix-hookshot.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: matrix_hookshot_systemd_service_result.changed

View File

@ -6,7 +6,7 @@
register: matrix_hookshot_service_stat
- name: Ensure matrix-hookshot is stopped
service:
ansible.builtin.service:
name: matrix-hookshot
state: stopped
enabled: false
@ -14,12 +14,12 @@
when: "matrix_hookshot_service_stat.stat.exists"
- name: Ensure matrix-hookshot.service doesn't exist
file:
ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-hookshot.service"
state: absent
when: "matrix_hookshot_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-hookshot.service removal
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_hookshot_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
---
- name: Fail if required settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''"
@ -10,7 +10,7 @@
- "matrix_hookshot_homeserver_token"
- name: Fail if required GitHub settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable GitHub.
when: "matrix_hookshot_github_enabled and vars[item] == ''"
@ -19,7 +19,7 @@
- "matrix_hookshot_github_secret"
- name: Fail if required GitHub OAuth settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable GitHub OAuth.
when: "matrix_hookshot_github_oauth_enabled and vars[item] == ''"
@ -28,7 +28,7 @@
- "matrix_hookshot_github_oauth_secret"
- name: Fail if required Jira settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable Jira.
when: "matrix_hookshot_jira_enabled and vars[item] == ''"
@ -36,7 +36,7 @@
- "matrix_hookshot_jira_secret"
- name: Fail if required Jira OAuth settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable Jira OAuth.
when: "matrix_hookshot_jira_oauth_enabled and vars[item] == ''"
@ -45,13 +45,13 @@
- "matrix_hookshot_jira_oauth_secret"
- name: Fail if required Figma settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define at least one Figma instance to enable Figma.
when: "matrix_hookshot_figma_enabled and matrix_hookshot_figma_instances is undefined"
- name: Fail if required provisioning settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable provisioning.
when: "matrix_hookshot_provisioning_enabled and vars[item] == ''"
@ -59,7 +59,7 @@
- "matrix_hookshot_provisioning_secret"
- name: (Deprecation) Catch and report old metrics usage
fail:
ansible.builtin.fail:
msg: >-
Your configuration contains a variable (`{{ item }}`), which refers to the old metrics collection system for Hookshot,
which exposed metrics on `https://stats.DOMAIN/hookshot/metrics`.