diff --git a/tasks/configure.yml b/tasks/configure.yml index 5e3ccb98..bcbdfcae 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -7,18 +7,19 @@ group: "{{postgresql_admin_user}}" state: directory mode: 0700 + register: pgdata_dir_exist - name: PostgreSQL | Reset the cluster - drop the existing one shell: pg_dropcluster --stop {{postgresql_version}} {{postgresql_cluster_name}} sudo: yes sudo_user: postgres - when: postgresql_cluster_reset + when: postgresql_cluster_reset and pgdata_dir_exist.changed - name: PostgreSQL | Reset the cluster - create a new one (with specified encoding and locale) shell: pg_createcluster --start --locale {{postgresql_locale}} -e {{postgresql_encoding}} -d {{postgresql_data_directory}} {{postgresql_version}} {{postgresql_cluster_name}} sudo: yes sudo_user: postgres - when: postgresql_cluster_reset + when: postgresql_cluster_reset and pgdata_dir_exist.changed - name: PostgreSQL | Update configuration - pt. 1 (pg_hba.conf) template: