From a24a57c2adef9cd4a8cdc55f3766548b22c66d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <anarcat@debian.org> Date: Fri, 15 Mar 2019 12:42:07 -0400 Subject: [PATCH] other ways of listing hosts, LDAP hack from weasel --- tsa/howto/puppet.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tsa/howto/puppet.mdwn b/tsa/howto/puppet.mdwn index 3a812222..b8317600 100644 --- a/tsa/howto/puppet.mdwn +++ b/tsa/howto/puppet.mdwn @@ -16,6 +16,22 @@ query: The currently known values are: `kvm`, `physical`, and `xenu`. +## Other ways of extracting a host list + + * Using the PuppetDB API: + + curl -s -G http://localhost:8080/pdb/query/v4/facts | jq -r ".[].certname" + + * Using [Cumin](https://doc.wikimedia.org/cumin/master/introduction.html) + + * Using LDAP: + + HOSTS=$(ssh alberti.torproject.org 'ldapsearch -h db.torproject.org -x -ZZ -b dc=torproject,dc=org -LLL "hostname=*.torproject.org" hostname | awk "\$1 == \"hostname:\" {print \$2}" | sort') + for i in `echo $HOSTS`; do mkdir hosts/x-$i 2>/dev/null || continue; echo $i; ssh $i ' ...'; done + + the mkdir is so that I can run the same command in many terminal + windows and each host gets only one once + Batch jobs on all hosts ======================= -- GitLab