pig do
pig do runs administration playbooks from the selected Pigsty directory. It uses the inventory to add clusters, create databases and users, install packages, or remove services.
Define the target configuration in the inventory first, then run the corresponding command. The commands invoke Ansible directly. This command group has no general --plan mode.
Inventory selection is shared with sty deploy. PIG passes the resolved
source to Ansible without interpreting it again relative to Pigsty home. Missing explicit,
environment, or default sources fail before playbook execution. Existing directory and executable
Inventory sources remain Ansible inputs; static Inventory commands do not execute them.
Command overview
| Command | Purpose | Required arguments |
|---|---|---|
pgsql-add | Add a PostgreSQL cluster or instances | cluster, optional IPs |
pgsql-rm | Remove a PostgreSQL cluster or instances | cluster, optional IPs |
pgsql-db | Apply a database declaration | cluster, database |
pgsql-user | Apply a user declaration | cluster, user |
pgsql-ext | Install extensions through Pigsty | cluster, optional extensions |
pgsql-hba | Refresh PostgreSQL HBA rules | cluster |
pgsql-svc | Refresh PostgreSQL service definitions | cluster |
pgmon-add / pgmon-rm | Add or remove a remote monitoring target | cluster |
node-add / node-rm | Add or remove selected nodes | one or more selectors |
node-repo | Configure repository modules on selected nodes | optional selector and modules |
node-pkg | Install or update packages on selected nodes | selector, optional packages |
repo-build | Rebuild the Pigsty infrastructure repository | none |
redis-add / redis-rm | Add or remove Redis clusters, nodes, or instances | selector, optional ports |
Run pig do COMMAND --help for the aliases and exact examples of one operation.
PostgreSQL operations
pgsql-db and pgsql-user apply existing pg_databases and pg_users declarations. They do not edit the inventory. pgsql-rm --uninstall also removes packages. Omit this option if the host still needs those packages.
Name rules
| Object | Accepted names |
|---|---|
| PostgreSQL cluster | Letters, digits, and hyphens; start with a letter or digit. root, all, and ungrouped are reserved. |
| PostgreSQL user | Up to 63 characters; start with a lowercase letter or _, then use lowercase letters, digits, _, @, ., or -. postgres is reserved. |
| Database | Up to 63 characters; start with a letter or _, then use letters, digits, _, @, ., or -. |
These rules apply to arguments that require a cluster, user, or database name. Selector arguments support the target-selection forms below.
Node and repository operations
Selectors may be cluster names, host names, IP addresses, or another selector form supported by the Pigsty playbook. Their meaning comes from the active Inventory.
With no selector, node-repo applies to every host targeted by node.yml. With no module, it uses the Inventory setting. Repository modules come from the installed Pigsty release, such as local,
infra, pgsql, node, and extra. Check that the required repositories are available to the
target nodes before installing packages.
Redis operations
redis-rm --uninstall also removes packages during node or cluster removal.
Configuration and output
pig do uses the global PIG options:
| Option | Purpose |
|---|---|
-H, --home | Select the Pigsty home directory |
-i, --inventory | Select the Pigsty Inventory |
-o, --output | Choose text, JSON, YAML, or pretty JSON result wrapping |
--log-level, --log-path | Configure PIG diagnostics |
Structured mode reports the requested operation and captured execution result. The underlying Ansible and playbook behavior is still determined by the installed Pigsty release.
See the Pigsty documentation for full playbook variables and procedures.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)