vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.69k stars 410 forks source link

unable to determine postgres_cluster_sshkey in the playbook #516

Closed kumarashish071092 closed 11 months ago

kumarashish071092 commented 11 months ago

I ma getting below error while deploying new node using add_pgnode.yml :

TASK [pgbackrest : ssh_keys | Add database ssh keys in "~postgres/.ssh/authorized_keys" on pgbackrest server] ***************
fatal: [10.10.X.X]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'postgres_cluster_sshkey'. 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'postgres_cluster_sshkey'\n\nThe error appears to be in '/home/deployer/supplier_connect_dev/postgresql_cluster/roles/pgbackrest/tasks/ssh_keys.yml': line 63, 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: ssh_keys | Add database ssh keys in \"~{{ pgbackrest_repo_user }}/.ssh/authorized_keys\" on pgbackrest server\n  ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"}

Also can we add new nodes using deploy_cluster.yml ?

vitabaks commented 11 months ago

Thanks @kumarashish071092

here's the fix https://github.com/vitabaks/postgresql_cluster/pull/517

Please test it.

kumarashish071092 commented 11 months ago

Thanks for quick turnaround.

Could you please let me know where do I have to make the changes .

I may be missing some point here.


From: Vitaliy Kukharik @.> Sent: Monday, November 27, 2023 3:56 PM To: vitabaks/postgresql_cluster @.> Cc: Kumar Ashish @.>; Mention @.> Subject: Re: [vitabaks/postgresql_cluster] unable to determine postgres_cluster_sshkey in the playbook (Issue #516)

[Email from a non-Nagarro source: please exercise caution with links and attachments]

Thanks @kumarashish071092https://github.com/kumarashish071092

here's the fix #517https://github.com/vitabaks/postgresql_cluster/pull/517

Please test it.

— Reply to this email directly, view it on GitHubhttps://github.com/vitabaks/postgresql_cluster/issues/516#issuecomment-1827556635, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXUU3UQHCFSBFMTUEY2VQTYGRTFPAVCNFSM6AAAAAA73XHGR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRXGU2TMNRTGU. You are receiving this because you were mentioned.Message ID: @.***>

vitabaks commented 11 months ago

download the branch with the fix

git clone --branch add-pgnode-pgbackrest --single-branch https://github.com/vitabaks/postgresql_cluster.git

or just replace the add_pgnode.yml file with this one https://github.com/vitabaks/postgresql_cluster/blob/a9d7608433500699ef15154a07ee72c6db1bb798/add_pgnode.yml

kumarashish071092 commented 11 months ago

HI Vitaly,

Thanks for the update. It worked smoothly.

One more point here : how can we use replica sync and sync node using psql ?


From: Vitaliy Kukharik @.> Sent: Monday, November 27, 2023 4:15 PM To: vitabaks/postgresql_cluster @.> Cc: Kumar Ashish @.>; Mention @.> Subject: Re: [vitabaks/postgresql_cluster] unable to determine postgres_cluster_sshkey in the playbook (Issue #516)

[Email from a non-Nagarro source: please exercise caution with links and attachments]

download the branch with the fix

git clone --btanch add-pgnode-pgbackrest --single-branch https://github.com/vitabaks/postgresql_cluster.git

or just replace the add_pgnode.yml file with this one https://github.com/vitabaks/postgresql_cluster/blob/a9d7608433500699ef15154a07ee72c6db1bb798/add_pgnode.yml

— Reply to this email directly, view it on GitHubhttps://github.com/vitabaks/postgresql_cluster/issues/516#issuecomment-1827585928, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXUU3RNV7H74Z7MUHTPJ7DYGRVM3AVCNFSM6AAAAAA73XHGR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRXGU4DKOJSHA. You are receiving this because you were mentioned.Message ID: @.***>

vitabaks commented 11 months ago

how can we use replica sync and sync node using psql ?

If synchronous_mode is true

psql -h < cluster_vip > -p 5002 -U postgres -d postgres