- name:Abort, if existing Postgres auto-upgrade data path detected
fail:
msg:"Detected that a left-over {{ postgres_auto_upgrade_backup_data_path }} exists. You should rename it to {{ matrix_postgres_data_path }} if the previous upgrade went wrong, or delete it if it went well."
when:"result_auto_upgrade_path.stat.exists"
- name:Determine existing Postgres version (check PG_VERSION file)
stat:
path:"{{ matrix_postgres_data_path }}/PG_VERSION"
register:result_pg_version_stat
- name:Abort, if no existing Postgres version detected
fail:msg="Could not find existing Postgres installation"
when:"not result_pg_version_stat.stat.exists"
- name:Determine existing Postgres version (read PG_VERSION file)
slurp:
src:"{{ matrix_postgres_data_path }}/PG_VERSION"
register:result_pg_version
- name:Determine existing Postgres version (default to empty)
set_fact:
pg_version:""
- name:Determine existing Postgres version (make sense of PG_VERSION file)
msg:"NOTE: Your Postgres data directory has been moved from `{{ matrix_postgres_data_path }}` to `{{ postgres_auto_upgrade_backup_data_path }}`. In the event of failure, you can move it back and run the playbook with --tags=setup-postgres to restore operation."
- include:tasks/setup_postgres.yml
- name:Ensure matrix-postgres autoruns and is restarted
msg:"NOTE: Your old Postgres data directory is preserved at `{{ postgres_auto_upgrade_backup_data_path }}`. You might want to get rid of it once you've confirmed that all is well."