pig do
pig do exposes common Pigsty administrative playbooks as explicit CLI operations. It uses the
selected Pigsty home and Inventory, builds the corresponding playbook command, and returns the
operation through PIG’s legacy structured-result adapter.
These commands change remote systems. Review the selected cluster, node, instance, and Inventory
before execution. The command family does not provide a general --plan mode.
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 |
Create or update a database declaration | cluster, database |
pgsql-user |
Create or update 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-rm --uninstall expands the removal scope to packages. Treat it as a separate destructive
decision and verify that the selected hosts no longer need those packages.
Commands whose operand is explicitly a PostgreSQL cluster validate it before running Ansible.
PIG accepts ^[A-Za-z0-9][A-Za-z0-9-]*$: this is Pigsty’s alphanumeric-and-hyphen contract with
an additional leading-alphanumeric CLI boundary, so an option-shaped value cannot become an
Ansible limit. root and the Ansible built-in groups all and ungrouped are reserved.
pgsql-user accepts Pigsty user names matching ^[a-z_][[email protected]]{0,62}$ and reserves
postgres. pgsql-db accepts a bounded ASCII name beginning with a letter or underscore and
continuing with letters, digits, _, @, ., or -; this keeps Inventory lookup and generated
path handling unambiguous without forcing database names to lowercase. Selector-oriented commands
retain the broader selector grammar.
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.
Repository modules include the modules provided by 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
As with PostgreSQL removal, redis-rm --uninstall broadens the change beyond service 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.
Operational boundary
pig do is a convenience layer over Pigsty administration playbooks. It does not replace
Inventory review, backups, change windows, or post-change service verification. For full playbook
variables and lifecycle semantics, use the documentation for the installed
Pigsty release.