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,5 +1,5 @@
---
- set_fact:
- ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-postgres-backup.service'] }}"
when: matrix_postgres_backup_enabled|bool

View File

@ -10,7 +10,7 @@
# If not, we install using the latest Postgres.
#
# Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`).
- set_fact:
- ansible.builtin.set_fact:
matrix_postgres_backup_docker_image_to_use: "{{ matrix_postgres_backup_docker_image_latest if matrix_postgres_backup_detected_version_corresponding_docker_image|default('') == '' else matrix_postgres_backup_detected_version_corresponding_docker_image }}"
when: matrix_postgres_backup_enabled|bool
@ -27,7 +27,7 @@
until: result is not failed
- name: Ensure Postgres backup paths exist
file:
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0700
@ -38,7 +38,7 @@
when: matrix_postgres_backup_enabled|bool
- name: Ensure Postgres environment variables file created
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/{{ item }}.j2"
dest: "{{ matrix_postgres_backup_path }}/{{ item }}"
owner: "{{ matrix_user_username }}"
@ -49,7 +49,7 @@
when: matrix_postgres_backup_enabled|bool
- name: Ensure matrix-postgres-backup.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-postgres-backup.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-postgres-backup.service"
mode: 0644
@ -57,7 +57,7 @@
when: matrix_postgres_backup_enabled|bool
- name: Ensure systemd reloaded after matrix-postgres-backup.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_postgres_backup_enabled|bool and matrix_postgres_backup_systemd_service_result.changed"
@ -72,7 +72,7 @@
when: "not matrix_postgres_backup_enabled|bool"
- name: Ensure matrix-postgres-backup is stopped
service:
ansible.builtin.service:
name: matrix-postgres-backup
state: stopped
enabled: false
@ -80,13 +80,13 @@
when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists"
- name: Ensure matrix-postgres-backup.service doesn't exist
file:
ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-postgres-backup.service"
state: absent
when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-postgres-backup.service removal
service:
ansible.builtin.service:
daemon_reload: true
when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists"
@ -98,7 +98,7 @@
# We just want to notify the user. Deleting data is too destructive.
- name: Inject warning if matrix-postgres backup data remains
set_fact:
ansible.builtin.set_fact:
matrix_playbook_runtime_results: |
{{
matrix_playbook_runtime_results|default([])

View File

@ -4,7 +4,7 @@
# If there is, it also tries to detect the Docker image that corresponds to that version.
- name: Initialize Postgres version determination variables (default to empty)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detection_pg_version_path: "{{ matrix_postgres_data_path }}/PG_VERSION"
matrix_postgres_backup_detected_existing: false
matrix_postgres_backup_detected_version: ""
@ -15,47 +15,47 @@
path: "{{ matrix_postgres_backup_detection_pg_version_path }}"
register: result_pg_version_stat
- set_fact:
- ansible.builtin.set_fact:
matrix_postgres_backup_detected_existing: true
when: "result_pg_version_stat.stat.exists"
- name: Determine existing Postgres version (read PG_VERSION file)
slurp:
ansible.builtin.slurp:
src: "{{ matrix_postgres_backup_detection_pg_version_path }}"
register: result_pg_version
when: matrix_postgres_backup_detected_existing|bool
- name: Determine existing Postgres version (make sense of PG_VERSION file)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detected_version: "{{ result_pg_version['content']|b64decode|replace('\n', '') }}"
when: matrix_postgres_backup_detected_existing|bool
- name: Determine corresponding Docker image to detected version (assume default of latest)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_latest }}"
when: "matrix_postgres_backup_detected_version != ''"
- name: Determine corresponding Docker image to detected version (use 9.x, if detected)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v9 }}"
when: "matrix_postgres_backup_detected_version.startswith('9.')"
- name: Determine corresponding Docker image to detected version (use 10.x, if detected)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v10 }}"
when: "matrix_postgres_backup_detected_version == '10' or matrix_postgres_backup_detected_version.startswith('10.')"
- name: Determine corresponding Docker image to detected version (use 11.x, if detected)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v11 }}"
when: "matrix_postgres_backup_detected_version == '11' or matrix_postgres_backup_detected_version.startswith('11.')"
- name: Determine corresponding Docker image to detected version (use 12.x, if detected)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v12 }}"
when: "matrix_postgres_backup_detected_version == '12' or matrix_postgres_backup_detected_version.startswith('12.')"
- name: Determine corresponding Docker image to detected version (use 13.x, if detected)
set_fact:
ansible.builtin.set_fact:
matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v13 }}"
when: "matrix_postgres_backup_detected_version == '13' or matrix_postgres_backup_detected_version.startswith('13.')"

View File

@ -1,7 +1,7 @@
---
- name: Fail if required Postgres settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''"