Allow multiple clusters on RedHat
Using multiple clusters in RedHat doesn't work, apparently due to SELinux. My testing shows that we can, so long as we use:
/var/lib/pgsql/{{ postgresql_version }}/{{ postgresql_cluster_name }}/data
By default this will end up in:
/var/lib/pgsql/{{ postgresql_version }}/main/data
Which also neatly allows us to separate out the pg_wal, pg_xlog into something like this, and stay within the SELinux restrictions:
/var/lib/pgsql/{{ postgresql_version }}/main/pg_wal
My changes include changes to:
- Default RedHat variables (Remove the hardcoding of the cluster_name, and change data directory name)
- configure.yml script (Change service name to include the cluster name)
- Removal of the old template for the default service directory
- Addition of a new template for the NEW service name
It seems that the current playbook creates the "systemd" files on CentOS v6... even though they are ignored there. This change restricts those changes to CentOS v7 and later, whilst leaving the current behaviour for CentOS v6 "service".
To achieve this, I've had to add an extra layer to the system-wide variables, so now there is "vars/CentOS-7.yml", as well as the current "vars/CentOS.yml. It will pick the most detailed one.
It seems that the current playbook creates the "systemd" files on CentOS v6... even though they are ignored there. This change restricts those changes to CentOS v7 and later, whilst leaving the current behaviour for CentOS v6 "service".
To achieve this, I've had to add an extra layer to the system-wide variables, so now there is "
vars/CentOS-7.yml", as well as the current "vars/CentOS.yml. It will pick the most detailed one.
We can use ansible_service_mgr fact instead of using CentOS versions variables. This is more scalable.