Ensure matrix_mautrix_facebook_docker_src_files_path created

Before we potentially clone to that path, we'd better make sure it exists.

We also simplify `when` statements a bit.
Given that we're in `setup_install.yml`, we know that the bridge is enabled,
so there's no need to check for that.
This commit is contained in:
Slavi Pantaleev 2021-01-13 17:59:46 +02:00 committed by GitHub
parent 105354a052
commit 5fa30cdfcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,13 +34,27 @@
when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_mautrix_telegram_database_engine == 'postgres'" when: "matrix_mautrix_telegram_database_engine == 'postgres'"
- name: Ensure Mautrix Telegram paths exist
file:
path: "{{ item }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- { path: "{{ matrix_mautrix_telegram_base_path }}", when: true }
- { path: "{{ matrix_mautrix_telegram_config_path }}", when: true }
- { path: "{{ matrix_mautrix_telegram_data_path }}", when: true }
- { path: "{{ matrix_mautrix_facebook_docker_src_files_path }}", when: "{{ matrix_mautrix_telegram_container_self_build }}" }
when: item.when|bool
- name: Ensure Mautrix Telegram image is pulled - name: Ensure Mautrix Telegram image is pulled
docker_image: docker_image:
name: "{{ matrix_mautrix_telegram_docker_image }}" name: "{{ matrix_mautrix_telegram_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
force_source: "{{ matrix_mautrix_telegram_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" force_source: "{{ matrix_mautrix_telegram_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_telegram_docker_image_force_pull }}" force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_telegram_docker_image_force_pull }}"
when: "matrix_mautrix_telegram_enabled|bool and not matrix_mautrix_telegram_container_self_build|bool" when: "not matrix_mautrix_telegram_container_self_build|bool"
- name: Ensure matrix-mautrix-telegram repository is present when self-building - name: Ensure matrix-mautrix-telegram repository is present when self-building
git: git:
@ -48,7 +62,7 @@
dest: "{{ matrix_mautrix_telegram_docker_src_files_path }}" dest: "{{ matrix_mautrix_telegram_docker_src_files_path }}"
force: "yes" force: "yes"
register: matrix_mautrix_telegram_git_pull_results register: matrix_mautrix_telegram_git_pull_results
when: "matrix_mautrix_telegram_enabled|bool and matrix_mautrix_telegram_container_self_build|bool" when: "matrix_mautrix_telegram_container_self_build|bool"
- name: Ensure matrix-mautrix-telegram Docker image is build - name: Ensure matrix-mautrix-telegram Docker image is build
docker_image: docker_image:
@ -59,19 +73,7 @@
dockerfile: Dockerfile dockerfile: Dockerfile
path: "{{ matrix_mautrix_telegram_docker_src_files_path }}" path: "{{ matrix_mautrix_telegram_docker_src_files_path }}"
pull: yes pull: yes
when: "matrix_mautrix_telegram_enabled|bool and matrix_mautrix_telegram_container_self_build|bool and matrix_mautrix_telegram_git_pull_results.changed" when: "matrix_mautrix_telegram_container_self_build|bool and matrix_mautrix_telegram_git_pull_results.changed"
- name: Ensure Mautrix Telegram paths exist
file:
path: "{{ item }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- "{{ matrix_mautrix_telegram_base_path }}"
- "{{ matrix_mautrix_telegram_config_path }}"
- "{{ matrix_mautrix_telegram_data_path }}"
- name: Check if an old database file already exists - name: Check if an old database file already exists
stat: stat: