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.
pull/24680/head
Pierre-Louis Bonicoli 7 years ago committed by Toshio Kuratomi
parent ce856c2123
commit fb1e7aaa81

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

Loading…
Cancel
Save