Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended to add a fool-proof design for node checking to control unnecessary operations #402

Closed
AdamYLK opened this issue May 1, 2024 · 2 comments
Assignees
Labels
API API Change Proposal NODE Node Related PGSQL PostgreSQL Related PROVISION Deploy & Provision Related
Milestone

Comments

@AdamYLK
Copy link

AdamYLK commented May 1, 2024

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

@Vonng
Copy link
Owner

Vonng commented May 2, 2024

There are two options for this purpose:

  1. also init node during bin/pgsql-add
  2. leave a mark file after node.yml and check it in pgsql.yml

@Vonng Vonng self-assigned this May 11, 2024
@Vonng Vonng added PROVISION Deploy & Provision Related API API Change Proposal PGSQL PostgreSQL Related NODE Node Related labels May 11, 2024
@Vonng Vonng added this to the v2.7 milestone May 11, 2024
@Vonng
Copy link
Owner

Vonng commented May 19, 2024

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.  "}

@Vonng Vonng closed this as completed in 2e6760c May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API API Change Proposal NODE Node Related PGSQL PostgreSQL Related PROVISION Deploy & Provision Related
Projects
Status: Done
Development

No branches or pull requests

2 participants