====== Foreman ====== ====== API ====== * Get hostgroups curl -u "admin" https:///api/hostgroups * Get hostgroups which match curl -u "admin" https:///api/hostgroups?search= * Create hostgroups pdt1 to pdt 10 inheriting from base/pdt for i in $(seq 1 10); do curl -X POST -H "Content-Type: application/json" \ -d "{\"hostgroup\": {\"name\": \"pdt${i}\", \"parent_id\": \"14\"}}" \ -u "admin" https:///api/hostgroups done ===== Update environment ===== # Import class into env production hammer proxy import-classes --environment production --id 1 # Apply puppet classe to hostgroup hammer hostgroup update --name '' --puppet-classes ',' # Override all smart class param for param_id in $(hammer sc-param list --environment production --search '' | cut -d'|' -f1 | grep -o '[0-9]*'); do hammer sc-param update --override true --omit true --id \${param_id} done