Skip to content

Instantly share code, notes, and snippets.

@actionjack
Created June 22, 2012 15:38
Show Gist options
  • Save actionjack/2973543 to your computer and use it in GitHub Desktop.
Save actionjack/2973543 to your computer and use it in GitHub Desktop.
updating foreman host's environment with the rest api
command line used: (need to change username and password)
curl -k -u [USERNAME]:[PASSWORD] -X PUT -H "Content-Type:application/json" -H "Accept:application/json" -d '{"host":{"subnet_id":null,"serial":null,"puppetproxy_id":null,"name":"cittavld10.globoi.com","managed":null,"last_report":null,"comment":"","architecture_id":1,"created_at":"2011-10-10T17:46:30Z","sp_mac":"","puppetmaster_name":"puppet-lab.dev.globoi.com","image_file":null,"updated_at":"2012-02-29T14:41:29Z","sp_name":"","mac":"00:16:3e:16:69:b8","installed_at":null,"domain_id":2,"use_image":null,"root_pass":"xybxa6JUkz63w","owner_id":2,"medium_id":null,"id":896,"hostgroup_id":null,"enabled":true,"build":false,"ptable_id":null,"sp_subnet_id":null,"puppet_status":0,"last_freshcheck":null,"ip":"127.0.01","environment_id":2,"source_file_id":null,"model_id":1,"environment":{"environment":{"name":"lab2","id":2}},"sp_ip":"","disk":null,"owner_type":"User","operatingsystem_id":5,"last_compile":"2011-08-21T04:02:27Z"}}' http://localhost:3000/hosts/cittavld10.globoi.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment