I'm trying to create a host using the foreman API but getting errors. I
don't think I am specifying enough information in my post. Does anyone
have an example of a valid POST request for creating an EC2 host?
Example:
curl -sS -u username -k -H "Content-Type: application/json" -XPOST
https://foreman.server/api/v2/hosts -d '
{
"host": {
"build": false,
"operatingsystem_name": "Ubuntu 12.04",
"operatingsystem_id": 7,
"environment_name": "production",
"environment_id": 5,
"name": "test.server",
"compute_resource_id": 8,
"provision_method": "image",
"certname": "test.server.local",
"image_id": 55,
"image_name": "Ubuntu v3",
"puppet_status": 0,
"organization_id": 22,
"location_id": 32,
"managed": true,
"enabled": true,
"owner_type": "User",
"owner_id": 7,
"architecture_name": "x86_64",
"architecture_id": 1,
"domain_name": "server.local",
"domain_id": 3,
"subnet_id": "subnet-89afc7eb"
}
}'
Using this, I get:
{
"error": {"id":null,"errors":{"mac":["has already been taken","is
invalid","can't be blank"],"ip":["is invalid"]},"full_messages":["MAC
address has already been taken","MAC address is invalid","MAC address can't
be blank","IP address is invalid"]}
}
How do i specify the subnet, security group, flavor, avail zone, managed
ip?