Hello,
I'm trying to write a small ruby script to automate bulk deployment of
hosts using the API. This seems to work fine except for the small detail
that Foreman skips over the step where it's supposed to actually create the
VM in vSphere.
I've mucked around a bit with what parameters I send in, mostly based on
successful deploys from the web UI, but nothing seems to make a difference
so far, so I'm mostly back to my more basic set of parameters.
This is what a deploy looks like in my script. When deploying via the web
the virtual instance creation happens between the "Authorized user…" and
"Create DHCP…" lines. Checking with tcpdump Foreman doesn't even try to
communicate with the VC server.
Processing by Api::V1::HostsController#create as JSON
Parameters: {"host"=>{"build"=>"1", "domain_id"=>"1",
"hostgroup_id"=>"2", "name"=>"sesthblx06p.mydomain.local",
"subnet_id"=>"7", "environment_id"=>"1", "compute_resource_id"=>"5",
"mac"=>"0000A8010106", "managed"=>"true", "enabled"=>"true",
"compute_profile_id"=>"4", "provision_method"=>"build"},
"capabilities"=>"build image", "provider"=>"vmware", "apiv"=>"v1"}
Authorized user admin(Admin User)
Create DHCP reservation for
sesthblx06p.apica.local-00:00:a8:01:01:06/192.168.189.105
Add the TFTP configuration for sesthblx06p.apica.local
Fetching required TFTP boot files for sesthblx06p.apica.local
Rendered api/v1/hosts/create.json.rabl (11.4ms)
Completed 200 OK in 3801.7ms (Views: 11.0ms | ActiveRecord: 44.7ms)
Connecting to database specified by database.yml
The host shows up in Foreman and everything looks fine, and FM knows where
it should be, for example looking in the VM tab of the host details shows
the right vCenter server and cluster, except it can't find it of course.
Oh and while I'm asking, about having to specify the MAC address when
deploying via the API, has anything changed here? I found this
issue: Bug #4408: cannot provision VM using API or UI - Foreman so I know the cause, but
that issue drifted away a bit from that particular point, is this something
that will change in the future?
Oh and this is Foreman 1.5 and Ruby 1.9.3 on Debian 7.
Regards
Johan