Relocate some tasks

This commit is contained in:
Slavi Pantaleev 2020-12-22 10:52:36 +02:00
parent 0f4649a45c
commit 6488e11d69

View file

@ -8,6 +8,23 @@
The matrix-bridge-mx-puppet-discord role needs to execute before the matrix-synapse role. The matrix-bridge-mx-puppet-discord role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- name: Check if an old database file already exists
stat:
path: "{{ matrix_mx_puppet_discord_base_path }}/database.db"
register: matrix_mx_puppet_discord_stat_database
- block:
- name: (Data relocation) Ensure matrix-mx-puppet-discord.service is stopped
service:
name: matrix-mx-puppet-discord
state: stopped
daemon_reload: yes
failed_when: False
- name: (Data relocation) Move mx-puppet-discord database file to ./data directory
command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db"
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
- name: Ensure MX Puppet Discord image is pulled - name: Ensure MX Puppet Discord image is pulled
docker_image: docker_image:
name: "{{ matrix_mx_puppet_discord_docker_image }}" name: "{{ matrix_mx_puppet_discord_docker_image }}"
@ -49,23 +66,6 @@
pull: yes pull: yes
when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build|bool" when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build|bool"
- name: Check if an old database file already exists
stat:
path: "{{ matrix_mx_puppet_discord_base_path }}/database.db"
register: matrix_mx_puppet_discord_stat_database
- name: (Data relocation) Ensure matrix-mx-puppet-discord.service is stopped
service:
name: matrix-mx-puppet-discord
state: stopped
daemon_reload: yes
failed_when: false
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
- name: (Data relocation) Move mx-puppet-discord database file to ./data directory
command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db"
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
- name: Ensure mx-puppet-discord config.yaml installed - name: Ensure mx-puppet-discord config.yaml installed
copy: copy:
content: "{{ matrix_mx_puppet_discord_configuration|to_nice_yaml }}" content: "{{ matrix_mx_puppet_discord_configuration|to_nice_yaml }}"