From 054e3959e970e5ceeaeddb33b34a7555f66666b4 Mon Sep 17 00:00:00 2001 From: ebner Date: Thu, 19 Mar 2026 14:34:04 +0100 Subject: [PATCH] add api topic --- docs/engineering-guide/puppet/api.md | 25 +++++++++++++++++++++++ docs/engineering-guide/puppet/overview.md | 12 ++++------- 2 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 docs/engineering-guide/puppet/api.md diff --git a/docs/engineering-guide/puppet/api.md b/docs/engineering-guide/puppet/api.md new file mode 100644 index 00000000..cd11d948 --- /dev/null +++ b/docs/engineering-guide/puppet/api.md @@ -0,0 +1,25 @@ +# Puppet API + +Puppet provides an API to query the inventory of hosts and their facts. This can be used for debugging purposes, but also to get information about the hosts in a more structured way than just looking at the sysdb. + +Following is an example of how to query the inventory using curl (returns about 80MB of json): + +```bash +curl -G https://puppet.psi.ch/pdb_api/inventory +``` + +To get the facts of a specific host, you can do: + +```bash +curl -G https://puppet.psi.ch/pdb_api/inventory --data-urlencode 'query=["=", "certname", "merlin-c-321.psi.ch"]' +``` + +With jq you can filter the output to get only the information you are interested in. For example, to get only the hostnames of all hosts, you can do: + +```bash +curl -G https://puppet.psi.ch/pdb_api/inventory | jq '.[].certname' +``` + +More details about what is possible with the API can be found here: +https://help.puppet.com/pdb/8/topics/query.htm + diff --git a/docs/engineering-guide/puppet/overview.md b/docs/engineering-guide/puppet/overview.md index 46f489b8..592893f6 100644 --- a/docs/engineering-guide/puppet/overview.md +++ b/docs/engineering-guide/puppet/overview.md @@ -1,7 +1,7 @@ # Overview -Puppet is used in master mode and the general idea is to make large use of indipendent and (relatively) small puppet modules and composing profiles and roles based on them to create classes that are assigned to the hosts. By independence of puppet modules we mean that each puppet module targets a single functionality (eg. `web server`, `afs client`) and this is choosen to keep the code of the single module smaller, more coherent and easier to debug. +Puppet is used in master mode and the general idea is to make large use of independent and (relatively) small puppet modules and composing profiles and roles based on them to create classes that are assigned to the hosts. By independence of puppet modules we mean that each puppet module targets a single functionality (eg. `web server`, `grafana server`) and this is choosen to keep the code of the single module smaller, more coherent and easier to debug. Furthermore the system makes use of some puppet modules from the [puppet forge](https://forge.puppet.com). These puppet modules are not accessed directly but through a PSI mirror. @@ -23,17 +23,13 @@ Here you can get a general overview: ## Puppet Environments We use Puppet environments for two purposes: + - roll out changes to a small subset of all systems first - module development The following environments exist: + - `prod` - The most stable, and most systems are attached to it. All changes to `prod` have to go through `preprod` first. - - `preprod` - production test environment - -- Development environments. These are private to a single developer, - can have names matching the regex ``^[a-z]+[a-z,0-9,_]+$`` like ``ganglia_issue_21`` or - ``klog_client``, and are used for developing and testing - changes. Generally, only individual systems are attached to these - environments. +- Development environments. These are private to a single developer, can have names matching the regex ``^[a-z]+[a-z,0-9,_]+$`` like ``ganglia_issue_21`` or ``klog_client``, and are used for developing and testing changes. Generally, only individual systems are attached to these environments.