More ansible-lint fixes

This commit is contained in:
Slavi Pantaleev 2022-07-18 12:28:39 +03:00
parent 983bf819ef
commit d073c7ecb3
84 changed files with 230 additions and 206 deletions

View file

@ -20,7 +20,7 @@
register: lsb_release_installation_result
- name: Reread ansible_lsb facts if lsb-release got installed
setup: filter=ansible_lsb*
ansible.builtin.setup: filter=ansible_lsb*
when: lsb_release_installation_result.changed
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml"

View file

@ -10,7 +10,7 @@
update_cache: true
- name: Ensure Docker's APT key is trusted
apt_key:
ansible.builtin.apt_key:
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
@ -19,7 +19,7 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker repository is enabled
apt_repository:
ansible.builtin.apt_repository:
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present
update_cache: true

View file

@ -12,7 +12,7 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker's RPM key is trusted
rpm_key:
ansible.builtin.rpm_key:
state: present
key: https://download.docker.com/linux/fedora/gpg
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
@ -33,7 +33,7 @@
when: matrix_docker_installation_enabled | bool
- name: Ensure Docker-Py is installed
pip:
ansible.builtin.pip:
name: docker-py
state: latest
when: matrix_docker_installation_enabled | bool

View file

@ -10,7 +10,7 @@
update_cache: true
- name: Ensure Docker's APT key is trusted
apt_key:
ansible.builtin.apt_key:
url: https://download.docker.com/linux/raspbian/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
@ -19,7 +19,7 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker repository is enabled
apt_repository:
ansible.builtin.apt_repository:
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
state: present
update_cache: true

View file

@ -10,7 +10,7 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker's RPM key is trusted
rpm_key:
ansible.builtin.rpm_key:
state: present
key: https://download.docker.com/linux/centos/gpg
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'

View file

@ -10,7 +10,7 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker's RPM key is trusted
rpm_key:
ansible.builtin.rpm_key:
state: present
key: https://download.docker.com/linux/centos/gpg
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
@ -38,7 +38,7 @@
when: matrix_docker_installation_enabled | bool
- name: Ensure Docker-Py is installed
pip:
ansible.builtin.pip:
name: docker-py
state: latest
when: matrix_docker_installation_enabled | bool

View file

@ -81,6 +81,7 @@
- name: Ensure MX Puppet Twitter repository is present on self build
ansible.builtin.git:
repo: "{{ matrix_mx_puppet_twitter_container_image_self_build_repo }}"
version: master
dest: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}"
force: "yes"
become: true

View file

@ -29,6 +29,7 @@ matrix_dynamic_dns_systemd_required_services_list: ['docker.service']
# Build the container from source when running in mode
matrix_dynamic_dns_container_image_self_build: false
matrix_dynamic_dns_container_image_self_build_repo: "https://github.com/linuxserver/docker-ddclient.git"
matrix_dynamic_dns_container_image_self_build_repo_branch: "{{ matrix_dynamic_dns_version }}"
# Config paths
matrix_dynamic_dns_base_path: "{{ matrix_base_data_path }}/dynamic-dns"

View file

@ -28,6 +28,7 @@
- name: Ensure Dynamic DNS repository is present on self build
ansible.builtin.git:
repo: "{{ matrix_dynamic_dns_container_image_self_build_repo }}"
version: "{{ matrix_dynamic_dns_container_image_self_build_repo_branch }}"
dest: "{{ matrix_dynamic_dns_docker_src_files_path }}"
force: "yes"
become: true

View file

@ -15,11 +15,13 @@
#
- name: Ensure Jitsi internal authentication users are configured
ansible.builtin.shell: "docker exec matrix-jitsi-prosody prosodyctl --config /config/prosody.cfg.lua register {{ item.username | quote }} meet.jitsi {{ item.password | quote }}"
ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-jitsi-prosody prosodyctl --config /config/prosody.cfg.lua register {{ item.username | quote }} meet.jitsi {{ item.password | quote }}"
with_items: "{{ matrix_jitsi_prosody_auth_internal_accounts }}"
when:
- matrix_jitsi_auth_type == "internal"
- matrix_jitsi_prosody_auth_internal_accounts|length > 0
register: matrix_jitsi_user_configuration_result
changed_when: matrix_jitsi_user_configuration_result.rc == 0
#
# Tasks related to configuring other Jitsi authentication mechanisms

View file

@ -90,9 +90,11 @@
register: matrix_ma1sd_git_pull_results
- name: Ensure ma1sd Docker image is built
ansible.builtin.shell: "DOCKER_BUILDKIT=1 ./gradlew dockerBuild"
args:
ansible.builtin.command:
cmd: ./gradlew dockerBuild
chdir: "{{ matrix_ma1sd_docker_src_files_path }}"
environment:
DOCKER_BUILDKIT: 1
when: matrix_ma1sd_git_pull_results.changed
- name: Ensure ma1sd Docker image is tagged correctly

View file

@ -51,6 +51,7 @@
{{ matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_apache_container_image }}
-c
'cat /password | htpasswd -i -c /data/matrix-metrics-htpasswd {{ matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username }} && chmod 600 /data/matrix-metrics-htpasswd'
changed_when: true
- name: Delete temporary metrics password file
ansible.builtin.file:

View file

@ -33,6 +33,7 @@
{{ matrix_postgres_docker_image_to_use }}
-c
'psql -h {{ matrix_postgres_connection_hostname }} --file=/matrix-postgres-init-additional-db-user-and-role.sql'
changed_when: true
- name: Delete additional database initialization SQL file for {{ additional_db.name }}
ansible.builtin.file:

View file

@ -131,6 +131,8 @@
{{ matrix_postgres_pgloader_docker_image }}
-c
'pgloader {{ matrix_postgres_db_migration_request.pgloader_options | default([]) | join(' ') }} /in.db {{ matrix_postgres_db_migration_request.dst }}'
register: matrix_postgres_migrate_db_to_postgres_import_result
changed_when: matrix_postgres_migrate_db_to_postgres_import_result.rc == 0
- block:
# We can't use `{{ role_path }}` here, neither with `import_tasks`, nor with `include_tasks`,
@ -152,12 +154,16 @@
{{ matrix_postgres_docker_image_to_use }}
psql --host=matrix-postgres --dbname={{ matrix_postgres_db_migration_request.additional_psql_statements_db_name }} --command='{{ item }}'
with_items: "{{ matrix_postgres_db_migration_request.additional_psql_statements_list }}"
register: matrix_postgres_migrate_db_to_postgres_additional_queries_result
changed_when: matrix_postgres_migrate_db_to_postgres_additional_queries_result.rc == 0
when: "matrix_postgres_db_migration_request.additional_psql_statements_list | default([])|length > 0"
- name: Archive {{ matrix_postgres_db_migration_request.engine_old }} database ({{ matrix_postgres_db_migration_request.src }} -> {{ matrix_postgres_db_migration_request.src }}.backup)
ansible.builtin.command:
cmd: "mv {{ matrix_postgres_db_migration_request.src }} {{ matrix_postgres_db_migration_request.src }}.backup"
register: matrix_postgres_migrate_db_to_postgres_move_result
changed_when: matrix_postgres_migrate_db_to_postgres_move_result.rc == 0
- name: Inject result
ansible.builtin.set_fact:

View file

@ -29,3 +29,5 @@
- name: Register user
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username|quote }} {{ password|quote }} {{ '1' if admin == 'yes' else '0' }}"
register: matrix_synapse_register_user_result
changed_when: matrix_synapse_register_user_result.rc == 0

View file

@ -21,6 +21,7 @@
async: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_time }}"
poll: 10
register: matrix_synapse_rust_synapse_compress_state_compress_room_command_result
changed_when: matrix_synapse_rust_synapse_compress_state_compress_room_command_result.rc == 0
- ansible.builtin.debug: var="matrix_synapse_rust_synapse_compress_state_compress_room_command_result"
@ -43,6 +44,7 @@
async: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_time }}"
poll: 10
register: matrix_synapse_rust_synapse_compress_state_psql_import_command_result
changed_when: matrix_synapse_rust_synapse_compress_state_psql_import_command_result.rc == 0
- name: Clean up
ansible.builtin.file:

View file

@ -70,6 +70,7 @@
async: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time }}"
poll: 10
register: matrix_synapse_rust_synapse_compress_state_find_rooms_command_result
changed_when: false
# We expect the output to be like this:
#

View file

@ -32,6 +32,7 @@
- name: Check if Synapse Docker image exists
ansible.builtin.command: "{{ matrix_host_command_docker }} images --quiet --filter 'reference={{ matrix_synapse_docker_image }}'"
register: matrix_synapse_docker_image_check_result
changed_when: false
# Invoking the `docker build` command here, instead of calling the `docker_image` Ansible module,
# because the latter does not support BuildKit.

View file

@ -38,6 +38,9 @@
- name: Generate password hash
ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password|quote }}"
register: password_hash
changed_when: false
- name: Update user password hash
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash {{ username|quote }} {{ password_hash.stdout|quote }}"
register: matrix_synapse_update_user_password_result
changed_when: matrix_synapse_update_user_password_result.rc == 0