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,7 +1,7 @@
---
- name: Get rid of old files and directories
file:
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items:

View File

@ -1,27 +1,27 @@
---
- name: Fail if invalid homeserver implementation
fail:
ansible.builtin.fail:
msg: "You need to set a valid homeserver implementation in `matrix_homeserver_implementation`"
when: "matrix_homeserver_implementation not in ['synapse', 'dendrite']"
# We generally support Ansible 2.7.1 and above.
- name: Fail if running on Ansible < 2.7.1
fail:
ansible.builtin.fail:
msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
when:
- "(ansible_version.major < 2) or (ansible_version.major == 2 and ansible_version.minor < 7) or (ansible_version.major == 2 and ansible_version.minor == 7 and ansible_version.revision < 1)"
# Though we do not support Ansible 2.9.6 which is buggy
- name: Fail if running on Ansible 2.9.6 on Ubuntu
fail:
ansible.builtin.fail:
msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
when:
- ansible_distribution == 'Ubuntu'
- "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6"
- name: (Deprecation) Catch and report renamed settings
fail:
ansible.builtin.fail:
msg: >-
Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
@ -35,7 +35,7 @@
# We have a dedicated check for this variable, because we'd like to have a custom (friendlier) message.
- name: Fail if matrix_homeserver_generic_secret_key is undefined
fail:
ansible.builtin.fail:
msg: |
The `matrix_homeserver_generic_secret_key` variable must be defined and have a non-null and non-empty value.
@ -47,7 +47,7 @@
when: "matrix_homeserver_generic_secret_key is none or matrix_homeserver_generic_secret_key == ''"
- name: Fail if required variables are undefined
fail:
ansible.builtin.fail:
msg: "The `{{ item.var }}` variable must be defined and have a non-null and non-empty value"
with_items:
- {'var': matrix_domain, 'value': "{{ matrix_domain|default('') }}"}
@ -58,7 +58,7 @@
when: "item.value is none or item.value == ''"
- name: Fail if uppercase domain used
fail:
ansible.builtin.fail:
msg: "Detected that you're using an uppercase domain name - `{{ item }}`. This will cause trouble. Please use all-lowercase!"
with_items:
- "{{ matrix_domain }}"
@ -67,21 +67,21 @@
when: "item != item|lower"
- name: Fail if using python2 on Archlinux
fail:
ansible.builtin.fail:
msg: "Detected that you're using python2 when installing onto Archlinux. Archlinux by default only supports python3."
when:
- ansible_distribution == 'Archlinux'
- ansible_python.version.major != 3
- name: Fail if architecture is set incorrectly
fail:
ansible.builtin.fail:
msg: "Detected that variable matrix_architecture {{ matrix_architecture }} appears to be set incorrectly. See docs/alternative-architectures.md. Server appears to be {{ ansible_architecture }}."
when: (ansible_architecture == "x86_64" and matrix_architecture != "amd64") or
(ansible_architecture == "aarch64" and matrix_architecture != "arm64") or
(ansible_architecture.startswith("armv") and matrix_architecture != "arm32")
- name: Fail if encountering usage of removed role (mx-puppet-skype)
fail:
ansible.builtin.fail:
msg: >-
Your configuration seems to include a reference to `matrix_mx_puppet_skype_enabled`. Are you trying to install the mx-puppet-skype bridge?
The playbook no longer includes a role for installing mx-puppet-skype, because the mx-puppet-bridge is unmaintained and has been reported as broken for a long time.

View File

@ -12,7 +12,7 @@
- block:
# ansible_lsb is only available if lsb-release is installed.
- name: Ensure lsb-release installed
apt:
ansible.builtin.apt:
name:
- lsb-release
state: present
@ -34,13 +34,13 @@
when: ansible_distribution == 'Archlinux'
- name: Ensure Docker is started and autoruns
service:
ansible.builtin.service:
name: docker
state: started
enabled: true
- name: "Ensure {{ matrix_ntpd_service }} is started and autoruns"
service:
ansible.builtin.service:
name: "{{ matrix_ntpd_service }}"
state: started
enabled: true

View File

@ -1,7 +1,7 @@
---
- name: Ensure APT usage dependencies are installed
apt:
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
@ -26,14 +26,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure APT packages are installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_ntpd_package }}"
state: latest
update_cache: true
- name: Ensure Docker is installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_docker_package_name }}"
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"

View File

@ -1,7 +1,7 @@
---
- name: Ensure Docker repository is enabled
template:
ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/{{ item }}"
dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root"
@ -18,14 +18,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure yum packages are installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_ntpd_package }}"
state: latest
update_cache: true
- name: Ensure Docker is installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_docker_package_name }}"
- python3-pip

View File

@ -1,7 +1,7 @@
---
- name: Ensure APT usage dependencies are installed
apt:
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
@ -26,14 +26,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure APT packages are installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_ntpd_package }}"
state: latest
update_cache: true
- name: Ensure Docker is installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_docker_package_name }}"
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"

View File

@ -1,7 +1,7 @@
---
- name: Ensure Docker repository is enabled
template:
ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo"
dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root"
@ -16,14 +16,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure yum packages are installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_ntpd_package }}"
state: latest
update_cache: true
- name: Ensure Docker is installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_docker_package_name }}"
- docker-python

View File

@ -1,7 +1,7 @@
---
- name: Ensure Docker repository is enabled
template:
ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo"
dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root"
@ -16,21 +16,21 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure EPEL is installed
yum:
ansible.builtin.yum:
name:
- epel-release
state: latest
update_cache: true
- name: Ensure yum packages are installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_ntpd_package }}"
state: latest
update_cache: true
- name: Ensure Docker is installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_docker_package_name }}"
- python3-pip

View File

@ -1,7 +1,7 @@
---
- name: Ensure Matrix base path exists
file:
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: "{{ matrix_base_data_path_mode }}"
@ -11,7 +11,7 @@
- "{{ matrix_base_data_path }}"
- name: Preserve vars.yml on the server for easily restoring if it gets lost later on
copy:
ansible.builtin.copy:
src: "{{ matrix_vars_yml_snapshotting_src }}"
dest: "{{ matrix_base_data_path }}/vars.yml"
owner: "{{ matrix_user_username }}"
@ -25,7 +25,7 @@
driver: bridge
- name: Ensure matrix-remove-all script created
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2"
dest: "{{ matrix_local_bin_path }}/matrix-remove-all"
mode: 0750

View File

@ -1,18 +1,18 @@
---
- name: Ensure Matrix group is created
group:
ansible.builtin.group:
name: "{{ matrix_user_groupname }}"
gid: "{{ omit if matrix_user_gid is none else matrix_user_gid }}"
state: present
register: matrix_group
- name: Set Matrix Group GID Variable
set_fact:
ansible.builtin.set_fact:
matrix_user_gid: "{{ matrix_group.gid }}"
- name: Ensure Matrix user is created
user:
ansible.builtin.user:
name: "{{ matrix_user_username }}"
uid: "{{ omit if matrix_user_uid is none else matrix_user_uid }}"
state: present
@ -23,5 +23,5 @@
register: matrix_user
- name: Set Matrix Group UID Variable
set_fact:
ansible.builtin.set_fact:
matrix_user_uid: "{{ matrix_user.uid }}"

View File

@ -4,7 +4,7 @@
#
# For running with another webserver, we recommend being part of the `matrix` group.
- name: Ensure Matrix static-files path exists
file:
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0755
@ -14,7 +14,7 @@
- "{{ matrix_static_files_base_path }}/.well-known/matrix"
- name: Ensure Matrix /.well-known/matrix/client file configured
copy:
ansible.builtin.copy:
content: "{{ matrix_well_known_matrix_client_configuration|to_nice_json }}"
dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/client"
mode: 0644
@ -22,7 +22,7 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure Matrix /.well-known/matrix/server file configured
copy:
ansible.builtin.copy:
content: "{{ matrix_well_known_matrix_server_configuration|to_nice_json }}"
dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/server"
mode: 0644
@ -31,7 +31,7 @@
when: matrix_well_known_matrix_server_enabled|bool
- name: Ensure Matrix /.well-known/matrix/server file deleted
file:
ansible.builtin.file:
path: "{{ matrix_static_files_base_path }}/.well-known/matrix/server"
state: absent
when: "not matrix_well_known_matrix_server_enabled|bool"

View File

@ -1,7 +1,7 @@
---
# This is for both RedHat 7 and 8
- name: Ensure fuse installed (RedHat)
yum:
ansible.builtin.yum:
name:
- fuse
state: latest
@ -9,7 +9,7 @@
# This is for both Debian and Raspbian
- name: Ensure fuse installed (Debian/Raspbian)
apt:
ansible.builtin.apt:
name:
- fuse
state: latest

View File

@ -1,7 +1,7 @@
---
# This is for both RedHat 7 and 8
- name: Ensure openssl installed (RedHat)
yum:
ansible.builtin.yum:
name:
- openssl
state: latest
@ -9,7 +9,7 @@
# This is for both Debian and Raspbian
- name: Ensure openssl installed (Debian/Raspbian)
apt:
ansible.builtin.apt:
name:
- openssl
state: latest