From fb1e7aaa81d926189f910cac5751fc623e37732c Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Sun, 7 May 2017 16:22:43 +0200 Subject: [PATCH] Creates cluster the same way Debian package does This task is only executed when the playbook has already been executed once, for example using 'ansible-test integration' with '--retry-error' switch when the first run fails. This modification allows to recreate default databases (postgres, template0 and template1) using the same encoding that the one used by the Debian package. Default encoding is 'SQL_ASCII' when default locale is not set in /etc/default/locale. --- test/integration/targets/setup_postgresql_db/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/targets/setup_postgresql_db/tasks/main.yml b/test/integration/targets/setup_postgresql_db/tasks/main.yml index e87687cd2d..239aba6183 100644 --- a/test/integration/targets/setup_postgresql_db/tasks/main.yml +++ b/test/integration/targets/setup_postgresql_db/tasks/main.yml @@ -63,9 +63,9 @@ when: ansible_os_family == "RedHat" and ansible_service_mgr != "systemd" - name: Initialize postgres (Debian) - command: /usr/bin/pg_createcluster {{ pg_ver }} main - # Sometimes package install creates the db cluster, sometimes this step is needed - ignore_errors: True + shell: '. /usr/share/postgresql-common/maintscripts-functions && set_system_locale && /usr/bin/pg_createcluster -u postgres {{ pg_verĀ }} main' + args: + creates: "/etc/postgresql/{{ pg_ver }}/" when: ansible_os_family == 'Debian' - name: Initialize postgres (Suse)