Playbooks
Pigsty provides a series of Ansible playbooks for automated deployment and management of various modules. This page provides navigation and summary of all playbooks.
Module Navigation
| Module | Description | |
|---|---|---|
| INFRA | 3 | Infrastructure module playbooks |
| NODE | 2 | Node management module playbooks |
| ETCD | 2 | ETCD cluster management playbooks |
| PGSQL | 7 | PostgreSQL cluster management playbooks |
| REDIS | 2 | Redis cluster management playbooks |
| MINIO | 2 | MinIO object storage management playbooks |
| FERRET | 1 | FerretDB management playbook |
| DOCKER | 1 | Docker management playbook |
Playbook Summary
The following table lists all available preset playbooks in Pigsty:
| Playbook | Module | Function |
|---|---|---|
deploy.yml | ADMIN | Deploy pigsty on current environment |
infra.yml | INFRA | Initialize pigsty infrastructure on infra nodes |
infra-rm.yml | INFRA | Remove infrastructure components from infra nodes |
node.yml | NODE | Manage nodes, adjust nodes to desired state |
node-rm.yml | NODE | Remove managed nodes from Pigsty |
etcd.yml | ETCD | Install and configure Etcd cluster |
etcd-rm.yml | ETCD | Remove Etcd cluster or members |
pgsql.yml | PGSQL | Initialize PostgreSQL cluster or add new replicas |
pgsql-rm.yml | PGSQL | Remove PostgreSQL cluster or instance |
pgsql-user.yml | PGSQL | Add new business users to existing PostgreSQL cluster |
pgsql-db.yml | PGSQL | Add new business databases to existing PostgreSQL cluster |
pgsql-monitor.yml | PGSQL | Monitor remote PostgreSQL instances |
pgsql-migration.yml | PGSQL | Generate migration manuals and scripts for existing PostgreSQL clusters |
pgsql-pitr.yml | PGSQL | Execute PostgreSQL Point-in-Time Recovery (PITR) |
redis.yml | REDIS | Initialize Redis cluster/node/instance |
redis-rm.yml | REDIS | Remove Redis cluster/node/instance |
minio.yml | MINIO | Install MinIO cluster |
minio-rm.yml | MINIO | Remove MinIO cluster |
mongo.yml | FERRET | Install FerretDB on nodes |
docker.yml | DOCKER | Install Docker Daemon and Docker Compose |
Playbook Usage Notes
Protection Mechanism
Multiple modules provide deletion protection through *_safeguard parameters:
- PGSQL:
pg_safeguardprevents accidental deletion of PostgreSQL clusters - ETCD:
etcd_safeguardprevents accidental deletion of Etcd clusters - MINIO:
minio_safeguardprevents accidental deletion of MinIO clusters
By default, these safeguard parameters are not enabled (undefined). It’s recommended to explicitly set them to true for initialized clusters in production environments.
When the protection switch is set to true, the corresponding *-rm.yml playbook will abort immediately. You can force override through command-line parameters:
./pgsql-rm.yml -l pg-test -e pg_safeguard=false
./etcd-rm.yml -e etcd_safeguard=false
./minio-rm.yml -l minio -e minio_safeguard=false
Limiting Execution Scope
When executing playbooks, it’s recommended to use the -l parameter to limit the execution scope:
./pgsql.yml -l pg-meta # Limit execution to pg-meta cluster
./node.yml -l 10.10.10.10 # Limit execution to specific node
./redis.yml -l redis-test # Limit execution to redis-test cluster
Idempotency
Most playbooks are idempotent and can be executed repeatedly. However, note:
infra.ymldoes not clear data by default and can be safely re-executed. All clean parameters (vmetrics_clean,vlogs_clean,vtraces_clean,grafana_clean,nginx_clean) default tofalse- To clear infrastructure data for rebuild, you need to explicitly set the corresponding clean parameter to
true - Be extra careful when repeatedly executing
*-rm.ymldeletion playbooks
Task Tags
You can use the -t parameter to execute only specific task subsets:
./pgsql.yml -l pg-test -t pg_service # Only refresh pg-test cluster services
./node.yml -t haproxy # Only set up haproxy on nodes
./etcd.yml -t etcd_launch # Only restart etcd service
Quick Command Reference
./deploy.yml # One-pass deployment
INFRA Module
./infra.yml # Initialize infrastructure
./infra-rm.yml # Remove infrastructure
NODE Module
./node.yml -l <cls|ip> # Add node
./node-rm.yml -l <cls|ip> # Remove node
bin/node-add <cls|ip> # Add node (wrapper script)
bin/node-rm <cls|ip> # Remove node (wrapper script)
ETCD Module
./etcd.yml # Initialize etcd cluster
./etcd-rm.yml # Remove etcd cluster
bin/etcd-add <ip> # Add etcd member (wrapper script)
bin/etcd-rm <ip> # Remove etcd member (wrapper script)
PGSQL Module
./pgsql.yml -l <cls> # Initialize PostgreSQL cluster
./pgsql-rm.yml -l <cls> # Remove PostgreSQL cluster
./pgsql-user.yml -l <cls> -e username=<user> # Create business user
./pgsql-db.yml -l <cls> -e dbname=<db> # Create business database
./pgsql-monitor.yml -e clsname=<cls> # Monitor remote cluster
./pgsql-pitr.yml -l <cls> -e '{"pg_pitr": {}}' # Execute PITR recovery
bin/pgsql-add <cls> # Initialize cluster (wrapper script)
bin/pgsql-rm <cls> # Remove cluster (wrapper script)
bin/pgsql-user <cls> <user> # Create user (wrapper script)
bin/pgsql-db <cls> <db> # Create database (wrapper script)
REDIS Module
./redis.yml -l <cls> # Initialize Redis cluster
./redis-rm.yml -l <cls> # Remove Redis cluster
MINIO Module
./minio.yml -l <cls> # Initialize MinIO cluster
./minio-rm.yml -l <cls> # Remove MinIO cluster
FERRET Module
./mongo.yml -l ferret # Install FerretDB
DOCKER Module
./docker.yml -l <host> # Install Docker
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.