Ensure mx-puppet-discord directories are created before attempting migration

Our old (base-path -> data-path) SQLite migration can't work otherwise.

It's probably not necessary to keep it anymore, but since we still do,
at least we should take care to ensure it works.
This commit is contained in:
Slavi Pantaleev 2020-12-22 13:44:33 +02:00
parent 44c9f4daca
commit d135cd9cd3

View file

@ -8,6 +8,20 @@
The matrix-bridge-mx-puppet-discord role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)"
- name: Ensure MX Puppet Discord paths exist
file:
path: "{{ item.path }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- { path: "{{ matrix_mx_puppet_discord_base_path }}", when: true }
- { path: "{{ matrix_mx_puppet_discord_config_path }}", when: true }
- { path: "{{ matrix_mx_puppet_discord_data_path }}", when: true }
- { path: "{{ matrix_mx_puppet_discord_docker_src_files_path }}", when: "{{ matrix_mx_puppet_discord_container_image_self_build }}" }
when: matrix_mx_puppet_discord_enabled|bool and item.when|bool
- name: Check if an old database file already exists
stat:
path: "{{ matrix_mx_puppet_discord_base_path }}/database.db"
@ -59,20 +73,6 @@
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_discord_docker_image_force_pull }}"
when: matrix_mx_puppet_discord_enabled|bool and not matrix_mx_puppet_discord_container_image_self_build
- name: Ensure MX Puppet Discord paths exist
file:
path: "{{ item.path }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- { path: "{{ matrix_mx_puppet_discord_base_path }}", when: true }
- { path: "{{ matrix_mx_puppet_discord_config_path }}", when: true }
- { path: "{{ matrix_mx_puppet_discord_data_path }}", when: true }
- { path: "{{ matrix_mx_puppet_discord_docker_src_files_path }}", when: "{{ matrix_mx_puppet_discord_container_image_self_build }}" }
when: matrix_mx_puppet_discord_enabled|bool and item.when|bool
- name: Ensure MX Puppet Discord repository is present on self build
git:
repo: "{{ matrix_mx_puppet_discord_container_image_self_build_repo }}"