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.
This commit is contained in:
Pierre-Louis Bonicoli 2017-05-07 16:22:43 +02:00 committed by Toshio Kuratomi
parent ce856c2123
commit fb1e7aaa81

View file

@ -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)