Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Foreman ====== ====== API ====== * Get hostgroups <code> curl -u "admin" https://<foreman>/api/hostgroups </code> * Get hostgroups which match <search> <code> curl -u "admin" https://<foreman>/api/hostgroups?search=<search> </code> * Create hostgroups pdt1 to pdt 10 inheriting from base/pdt <code> 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://<foreman>/api/hostgroups done </code> ===== Update environment ===== <code> # Import class into env production hammer proxy import-classes --environment production --id 1 # Apply puppet classe to hostgroup hammer hostgroup update --name '<hostgroup>' --puppet-classes '<class1>,<class2>' # Override all smart class param for param_id in $(hammer sc-param list --environment production --search '<criteria>' | cut -d'|' -f1 | grep -o '[0-9]*'); do hammer sc-param update --override true --omit true --id \${param_id} done </code> cheatsheet/foreman.txt Last modified: 2024/10/14 20:59by 127.0.0.1