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

old postgres_ha_cluster_master_host stuck when trying new cluster #12

Closed frank3427 closed 7 years ago

frank3427 commented 7 years ago

I am running against a new cluster group when I run the role against a new cluster group, it is failing [root@AnsibleServer ~]# ansible-playbook --ask-pass sds-postgres-ha.yml --flush-cache SSH password:

PLAY [install PG/Redis HA] *****

TASK [Gathering Facts] ***** ok: [sds02.prodea-int.net] ok: [sds01.prodea-int.net]

TASK [disable firewall] **** ok: [sds01.prodea-int.net] ok: [sds02.prodea-int.net]

TASK [postgres-ha : debug] ***** ok: [sds01.prodea-int.net] => { "msg": "MASTER NODE SET TO dbs03.prodea-int.net" }

TASK [postgres-ha : verify postgres_ha_cluster_master_host] **** fatal: [sds01.prodea-int.net]: FAILED! => {"changed": false, "failed": true, "msg": "CRITICAL: defined master host (dbs03.prodea-int.net) is not in host list ([u'sds01.prodea-int.net', u'sds02.prodea-int.net'])"} fatal: [sds02.prodea-int.net]: FAILED! => {"changed": false, "failed": true, "msg": "CRITICAL: defined master host (dbs03.prodea-int.net) is not in host list ([u'sds01.prodea-int.net', u'sds02.prodea-int.net'])"} to retry, use: --limit @/root/sds-postgres-ha.retry

PLAY RECAP ***** sds01.prodea-int.net : ok=3 changed=0 unreachable=0 failed=1
sds02.prodea-int.net : ok=2 changed=0 unreachable=0 failed=1

[root@AnsibleServer ~]#

YanChii commented 7 years ago

Hi @frank3427. The error message is saying that postgres_ha_cluster_master_host is set to dbs03.prodea-int.net but you run this role over sds0[12].prodea-int.net. The postgres_ha_cluster_master_host should point to a host that is present in the ansible play (and is the master pg database). Jan

frank3427 commented 7 years ago

I have two clusters 1) dbs 2) sds each cluster has 2 hosts I first ran against dbs, all went well, then I ran against sds. in the sds run it failed with master needing to be dbs

I ran the role against a new host_group I was expecting sds01 to be master, based on postgres_ha_cluster_master_host: "{{ ansible_play_batch[0] }}"

YanChii commented 7 years ago

Can you please share your main yml file?

frank3427 commented 7 years ago

sorry, i will close the issue, I found the variable hardcoded.

frank@djfamily.net