YanChii / ansible-role-postgres-ha

Create postgresql HA auto-failover cluster using pcs, pacemaker and PAF
Apache License 2.0
33 stars 22 forks source link

separate role out #15

Open frank3427 opened 6 years ago

frank3427 commented 6 years ago

A while ago we chatted about separating the role so that it could be more modular for other applications that one might want to cluster a few examples; apache mysql redis haproxy

my thought was 3 roles 1) deploy cluster 2) deploy application 3) deploy and define cluster resources and constraints

YanChii commented 6 years ago

In my view there's no point in separating application deployment from defining cluster resources (roles 2 and 3). If you want an application working in the cluster, you just install it and add appropriate resources and constraints. Very easy when compared to cluster installation itself.

Anyway, I agree that separating the cluster deployment from specific usage patterns is a good way to go. I already have an ansible lib files to better embrace the pcs command to be able to safely check for constraints and resources. I'll try to put it together.

frank3427 commented 6 years ago

I agree,
one for cluster(#1) and a second (#2 and #3) for app deployment

YanChii commented 6 years ago

As soon as the #8 is merged, I'll start working on this.

mdiehn commented 3 years ago

Case in point: I'm writing TF and Ansible to create clusters for Atlassian data center applications for multiple environments: Each setup is three app servers, an NFS HA pair, a DB HA pair. TF creates the seven VMs for me from packer-made CentOS minimal-installation templates. I've been planning on making roles for these purposes:

1 Customize the VMs to our local sysadmin standards. 2 Make a Pacemaker cluster on the two NFS and two DB servers. 3 Build an HA NFS service on the two NFS VMs in the new cluster 4 Build an HA PostgreSQL service on the two DB VMs in the new cluster 5,6,7 Prepare the three app servers VMs to be an Atlassian Data Center cluster for Jira, Confluence, or Bitbucket.

Roles 1, 2, and 3 are all done.

This evening before I noticed this issue, I'd made a start on pulling out the tasks for the Postgres and PAF into a separate role to be my 4th role.

I'd be happy to do that in conjunction with your work here.

Also, since I'm using CentOS 8 Stream, I'm also updating for that here.

YanChii commented 3 years ago

Hi @mdiehn That would be perfect. I've already done preparation for Centos 8 by changing the PCS libs in separate branch https://github.com/YanChii/ansible-role-postgres-ha/tree/pcs-libs-change . The work is probably done but I didn't have time to test it so it's not merged yet. It should work (also) on Centos 7. Thank you. Jan

mdiehn commented 3 years ago

Any thoughts yet on organization? Perhaps shift this role into a roles/pacemaker directory and then make a new roles/postgres-ha directory (names TBD).

YanChii commented 3 years ago

Not bad idea. I didn't know the role hierarchy is supported in galaxy. I was thinking about making the new roles depend on themselves as necessary using ansible-galaxy. This role is not on galaxy yet so we can create/publish new roles and let this one here as legacy (with link to new ones in readme).

One role can be for the PCS cluster install. Other roles can be for generic resource, vip, pg cluster, etc. Maybe the resource role can even handle all resource types. Pg cluster role could also reuse the resource role.