pigsty
pigsty copied to clipboard
Recommended to add a fool-proof design for node checking to control unnecessary operations
For example, when executing the creation of a PGSQL node or cluster, due to the personnel quality issues of the R&D and operation and maintenance teams of small and medium-sized enterprises, it is very likely that the creation will not be completed before adding the nodes involved in the operation to pigsty for management. PGSQL or cluster, resulting in components such as pgbouncer not being created with business components first, which in turn caused the subsequent pgbouncer_exporter business to fail to be created.
Yes, you are right, i'm the guy just make this mistake
There are two options for this purpose:
- also init node during
bin/pgsql-add - leave a mark file after node.yml and check it in pgsql.yml
Will be implemented via an extra check in task pg_check:
#--------------------------------------------------------------#
# Check PostgreSQL Exists [pg_check]
#--------------------------------------------------------------#
- name: check postgres exists
tags: pg_check
block:
# check node is managed by pigsty by the existence of ca.crt
- name: check if node is managed by pigsty
stat: path=/etc/pki/ca.crt
register: check_ca_crt_result
- name: ABORT due to install on unmanaged node
when: not check_ca_crt_result.stat.exists
connection: local
any_errors_fatal: true
ignore_errors: false
fail:
msg: >-
Abort because the node {{ inventory_hostname }} seems not managed by pigsty, use ./node.yml to init node first.
When run pgsql.yml on a node that is not inited by Pigsty, The result would be like:
fatal: [10.10.10.41]: FAILED! => {"changed": false, "msg": "Abort because the node 10.10.10.41 seems not managed by pigsty, use ./node.yml to init node first. "}