Version v3.7.0 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.
CMDB
Pigsty allows you to use a database (CMDB) as a dynamic configuration source instead of a static configuration file. You can use the built-in PostgreSQL as config inventory for config management.
With Postgres CMDB, configuration is organized in structured relational tables, which can be easily queried and manipulated using SQL. This allows for easier integration with other systems and tools.
How does it work?
Ansible allows you to use a dynamic inventory script to generate the inventory config on-the-fly.
The idea is to replace static pigsty.yml in ansible.cfg with a dynamic shell script inventory.sh
The content of inventory.sh is very simple, it will query the PostgreSQL CMDB and retrieve config.
bin/inventory_load: Loads YAML config file into the CMDBbin/inventory_cmdb: Use CMDB as config inventory (meta.pigsty)bin/inventory_conf: Use YAML file as config inventory (pigsty.yml)
CMDB Schema
The CMDB baseline schema is shipped with pigsty: files/cmdb.sql
And most of the default config templates will use it as example baseline. Which means it can be used by default.
Load Config Data
CMDB is empty by default, load config file into the CMDB with the bin/inventory_load script.
Run bin/inventory_load without arguments will load the default pigsty.yml into the default CMDB.
Use -p to specify the config file path, and -d to specify the CMDB URL.
Switch Inventory
You can switch to dynamic CMDB inventory with:
Which essentially changes the inventory parameter in the ansible.cfg to use the inventory.sh script.