Skip to content

Instantly share code, notes, and snippets.

@ohadlevy
Created January 1, 2012 08:49
Show Gist options
  • Save ohadlevy/1546769 to your computer and use it in GitHub Desktop.
Save ohadlevy/1546769 to your computer and use it in GitHub Desktop.
#! /bin/sh
#
USER="ci"
PASS="ci"
FOREMAN_URL="https://foreman.domain.org"
NAME=$1
HOSTGROUP_ID="1" # Change this to your favorite hostgroup
curl -s -H "Accept:application/json" \
-k -u $USER:$PASS \
-d "host[name]=$NAME" -d "host[hostgroup_id]=$HOSTGROUP_ID" \
-d "host[powerup]=1" -d "host[build]=1" \
$FOREMAN_URL/hosts | prettify_json.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment