Closed ben-ihelputech closed 1 year ago
Also worth noting, when running in an LXD container, corosync needs to be a privileged container, or else the service will fail.
You must to define maas_postgres_floating_ip
and maas_postgres_floating_ip_prefix_len
when deploying HA postgres.
Pacemaker and Corosync are not being installed because processing in those nodes was aborted sooner:
fatal: [maas-db02.example.com]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'maas_postgres_floating_ip' is undefined. 'maas_postgres_floating_ip' is undefined\n\nThe error appears to be in '/Users/ben/git/maas-ansible-playbook/roles/maas_postgres/tasks/configure_postgres_secondary.yaml': line 50, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Create Base Backup\"\n ^ here\n"}
fatal: [maas-db03.example.com]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'maas_postgres_floating_ip' is undefined. 'maas_postgres_floating_ip' is undefined\n\nThe error appears to be in '/Users/ben/git/maas-ansible-playbook/roles/maas_postgres/tasks/configure_postgres_secondary.yaml': line 50, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Create Base Backup\"\n ^ here\n"}
Turns out I was referencing an outdated version of the readme. Entering those variables resolved the issue.
Problem
When defining multiple PostgreSQL hosts, the database fails to complete the setup. This seems to be due to an issue with Corosync and pacemaker not getting installed on all of the database hosts.
Setup
I have three physical LXD hosts, one amd64 (lxd-01) and two arm64 (lxd-02, lxd-03), clustered together. I have a custom script that deploys identical LXD containers based on a yaml file. They are connected to an unmanaged bridge and using cloud-init to setup networking. Connectivity has been confirmed between the containers.
Here is the inventory file I'm using:
Note: I am only specifying a single region and rack controller while I'm testing the HA PostgreSQL setup, so that is why other hosts in the inventory are commented out.
Worth noting
This is where I would think corosync and pacemaker need to be installed on the other db hosts. Here, you can see it is only being installed on
maas-db01
.Full Output
ansible-playbook -i inventory.yaml ./site.yaml