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

@ -1,12 +1,12 @@
---
- set_fact:
- ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-element.service'] }}"
when: matrix_client_element_enabled|bool
# 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
fail:
ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_client_element_container_image_self_build and matrix_client_element_enabled"

View File

@ -7,7 +7,7 @@
when: "matrix_client_element_enabled|bool"
- name: Ensure matrix-riot-web is stopped
service:
ansible.builtin.service:
name: matrix-riot-web
state: stopped
enabled: false
@ -16,13 +16,13 @@
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists"
- name: Ensure matrix-riot-web.service doesn't exist
file:
ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-riot-web.service"
state: absent
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-riot-web.service removal
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists"
@ -33,5 +33,5 @@
when: "matrix_client_element_enabled|bool"
- name: Relocate /matrix/riot-web to /matrix/client-element
command: "mv /matrix/riot-web /matrix/client-element"
ansible.builtin.command: "mv /matrix/riot-web /matrix/client-element"
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_dir_stat.stat.exists"

View File

@ -6,7 +6,7 @@
- block:
- name: Ensure Element themes repository is pulled
git:
ansible.builtin.git:
repo: "{{ matrix_client_element_themes_repository_url }}"
dest: "{{ role_path }}/files/scratchpad/themes"
@ -18,13 +18,13 @@
register: matrix_client_element_theme_file_list
- name: Read Element theme
slurp:
ansible.builtin.slurp:
path: "{{ item.path }}"
register: "matrix_client_element_theme_file_contents"
with_items: "{{ matrix_client_element_theme_file_list.files }}"
- name: Load Element theme
set_fact:
ansible.builtin.set_fact:
matrix_client_element_settingDefaults_custom_themes: "{{ matrix_client_element_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}"
with_items: "{{ matrix_client_element_theme_file_contents.results }}"
@ -39,7 +39,7 @@
#
- name: Ensure Element themes repository is removed
file:
ansible.builtin.file:
path: "{{ role_path }}/files/scratchpad/themes"
state: absent
run_once: true

View File

@ -1,10 +1,10 @@
---
- set_fact:
- ansible.builtin.set_fact:
matrix_client_element_url_endpoint_public: "https://{{ matrix_server_fqn_element }}/config.json"
- name: Check Element
uri:
ansible.builtin.uri:
url: "{{ matrix_client_element_url_endpoint_public }}"
follow_redirects: none
validate_certs: "{{ matrix_client_element_self_check_validate_certificates }}"
@ -13,10 +13,10 @@
ignore_errors: true
- name: Fail if Element not working
fail:
ansible.builtin.fail:
msg: "Failed checking Element is up at `{{ matrix_server_fqn_element }}` (checked endpoint: `{{ matrix_client_element_url_endpoint_public }}`). Is Element running? Is port 443 open in your firewall? Full error: {{ matrix_client_element_self_check_result }}"
when: "matrix_client_element_self_check_result.failed or 'json' not in matrix_client_element_self_check_result"
- name: Report working Element
debug:
ansible.builtin.debug:
msg: "Element at `{{ matrix_server_fqn_element }}` is working (checked endpoint: `{{ matrix_client_element_url_endpoint_public }}`)"

View File

@ -1,7 +1,7 @@
---
- name: Ensure Element paths exists
file:
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
@ -25,7 +25,7 @@
until: result is not failed
- name: Ensure Element repository is present on self-build
git:
ansible.builtin.git:
repo: "{{ matrix_client_element_container_image_self_build_repo }}"
dest: "{{ matrix_client_element_docker_src_files_path }}"
version: "{{ matrix_client_element_docker_image.split(':')[1] }}"
@ -39,13 +39,13 @@
# - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1357
# - https://github.com/vector-im/element-web/issues/19544
- name: Patch webpack.config.js to support building on low-memory (<4G RAM) devices
lineinfile:
ansible.builtin.lineinfile:
path: "{{ matrix_client_element_docker_src_files_path }}/webpack.config.js"
regexp: '(\s+)splitChunks: \{'
line: '\1splitChunks: { maxSize: 100000,'
backrefs: true
owner: root
group: root
ansible.builtin.group: root
mode: '0644'
when: "matrix_client_element_container_image_self_build|bool and matrix_client_element_container_image_self_build_low_memory_system_patch_enabled|bool"
@ -62,7 +62,7 @@
when: "matrix_client_element_container_image_self_build|bool"
- name: Ensure Element configuration installed
copy:
ansible.builtin.copy:
content: "{{ matrix_client_element_configuration|to_nice_json }}"
dest: "{{ matrix_client_element_data_path }}/config.json"
mode: 0644
@ -70,7 +70,7 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure Element config files installed
template:
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ matrix_client_element_data_path }}/{{ item.name }}"
mode: 0644
@ -83,7 +83,7 @@
when: "item.src is not none"
- name: Ensure Element config files removed
file:
ansible.builtin.file:
path: "{{ matrix_client_element_data_path }}/{{ item.name }}"
state: absent
with_items:
@ -91,13 +91,13 @@
when: "item.src is none"
- name: Ensure matrix-client-element.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-client-element.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-client-element.service"
mode: 0644
register: matrix_client_element_systemd_service_result
- name: Ensure systemd reloaded after matrix-client-element.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_client_element_systemd_service_result.changed|bool"

View File

@ -6,7 +6,7 @@
register: matrix_client_element_service_stat
- name: Ensure matrix-client-element is stopped
service:
ansible.builtin.service:
name: matrix-client-element
state: stopped
enabled: false
@ -15,18 +15,18 @@
when: "matrix_client_element_service_stat.stat.exists|bool"
- name: Ensure matrix-client-element.service doesn't exist
file:
ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-client-element.service"
state: absent
when: "matrix_client_element_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-client-element.service removal
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_client_element_service_stat.stat.exists|bool"
- name: Ensure Element paths doesn't exist
file:
ansible.builtin.file:
path: "{{ matrix_client_element_data_path }}"
state: absent

View File

@ -1,7 +1,7 @@
---
- name: Fail if required Element settings not defined
fail:
ansible.builtin.fail:
msg: >
You need to define a required configuration setting (`{{ item }}`) for using Element.
when: "vars[item] == ''"
@ -9,7 +9,7 @@
- "matrix_client_element_default_hs_url"
- name: (Deprecation) Catch and report riot-web variables
fail:
ansible.builtin.fail:
msg: >-
Riot has been renamed to Element (https://element.io/blog/welcome-to-element/).
The playbook will migrate your existing configuration and data automatically, but you need to adjust variable names.