diff --git a/roles/your_spotify/tasks/main.yml b/roles/your_spotify/tasks/main.yml index 185e849017..a81c1e357c 100644 --- a/roles/your_spotify/tasks/main.yml +++ b/roles/your_spotify/tasks/main.yml @@ -19,11 +19,29 @@ dns_zone: "{{ lookup('vars', role_name + '_dns_zone') }}" dns_proxy: "{{ lookup('vars', role_name + '_dns_proxy') }}" +- name: Check for previous '/opt/your_spotify_db' folder + ansible.builtin.stat: + path: "/opt/your_spotify_db" + register: your_spotify_old_database + +- name: Migration Block + when: your_spotify_old_database.stat.exists + block: + - name: Remove existing Docker container + ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml" + vars: + _var_prefix: "your_spotify_db" + + - name: Move folder + ansible.builtin.shell: mv /opt/your_spotify_db /opt/your-spotify-db + become: true + become_user: "{{ user.name }}" + - name: MongoDB Role ansible.builtin.include_role: name: mongodb vars: - mongodb_instances: ["your_spotify_db"] + mongodb_instances: ["your-spotify-db"] mongodb_paths_location: "{{ server_appdata_path }}/{{ your_spotify_name }}" - name: Remove existing Docker container