Skip to content

Instantly share code, notes, and snippets.

@jkaufman303
Created August 18, 2013 11:58
Show Gist options
  • Save jkaufman303/6261290 to your computer and use it in GitHub Desktop.
Save jkaufman303/6261290 to your computer and use it in GitHub Desktop.
foreman api ec2 deploy
#! /bin/sh
#
USER="admin"
PASS="changeme"
#FOREMAN_URL="http://172.30.8.173:8080"
FOREMAN_URL="http://localhost:8080"
NAME=$1
HOSTGROUP_ID="1" # Change this to your favorite hostgroup
#curl -s -H "Accept:application/json" \
curl -s -H "Accept:application/json" \
-u $USER:$PASS \
-d "host[name]=$NAME" \
-d "host[compute_resource_id]=1" \
-d "host[environment_id]=1" \
-d "host[hostgroup_id]=$HOSTGROUP_ID" \
-d "host[enabled]=1" \
-d "host[is_owned_by]=" \
-d "host[puppetclass_ids]=" \
-d "host[comment]=" \
-d "host[overwrite]=false" \
-d "host[operatingsystem_id]=1" \
-d "host[domain_id]=1" \
-d "host[architecture_id]=1" \
-d "host[provision_method]=image" \
-d "host[compute_attributes][flavor_id]=m1.small" \
-d "host[compute_attributes][image_id]=ami-313b8e58" \
-d "host[compute_attributes][availability_zone]=" \
-d "host[compute_attributes][groups][]=default" \
-d "capabilities=image" \
$FOREMAN_URL/hosts | prettify_json.rb
# -d "host[progress_report_id]=3" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment