Delete scripts when uninstalling Postgres

This commit is contained in:
Slavi Pantaleev 2019-07-08 08:05:31 +03:00
parent 84f5a0fa69
commit e805044b80

View file

@ -1,7 +1,7 @@
--- ---
# #
# Generic tasks, no matter what kind of server we're using (internal/external) # Tasks related to setting up an internal postgres server
# #
- import_tasks: "{{ role_path }}/tasks/migrate_postgres_data_directory.yml" - import_tasks: "{{ role_path }}/tasks/migrate_postgres_data_directory.yml"
@ -32,8 +32,6 @@
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_postgres_docker_image_force_pull }}" force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_postgres_docker_image_force_pull }}"
when: matrix_postgres_enabled|bool when: matrix_postgres_enabled|bool
# We always create these directories, even if an external Postgres is used,
# because we store environment variable files there.
- name: Ensure Postgres paths exist - name: Ensure Postgres paths exist
file: file:
path: "{{ item }}" path: "{{ item }}"
@ -70,9 +68,12 @@
mode: 0750 mode: 0750
when: matrix_postgres_enabled|bool when: matrix_postgres_enabled|bool
# - name: Ensure matrix-postgres-update-user-password-hash script created
# Tasks related to setting up an internal postgres server template:
# src: "{{ role_path }}/templates/usr-local-bin/matrix-postgres-update-user-password-hash.j2"
dest: "/usr/local/bin/matrix-postgres-update-user-password-hash"
mode: 0750
when: matrix_postgres_enabled|bool
- name: Ensure matrix-postgres.service installed - name: Ensure matrix-postgres.service installed
template: template:
@ -127,9 +128,12 @@
msg: "Note: You are not using a local PostgreSQL database, but some old data remains from before in `{{ matrix_postgres_data_path }}`. Feel free to delete it." msg: "Note: You are not using a local PostgreSQL database, but some old data remains from before in `{{ matrix_postgres_data_path }}`. Feel free to delete it."
when: "not matrix_postgres_enabled|bool and matrix_postgres_data_path_stat.stat.exists" when: "not matrix_postgres_enabled|bool and matrix_postgres_data_path_stat.stat.exists"
- name: Ensure matrix-postgres-update-user-password-hash script created - name: Remove Postgres scripts
template: file:
src: "{{ role_path }}/templates/usr-local-bin/matrix-postgres-update-user-password-hash.j2" path: "/usr/local/bin/{{ item }}"
dest: "/usr/local/bin/matrix-postgres-update-user-password-hash" state: absent
mode: 0750 with_items:
when: matrix_postgres_enabled|bool - matrix-postgres-cli
- matrix-make-user-admin
- matrix-postgres-update-user-password-hash
when: "not matrix_postgres_enabled|bool"