I am using Foreman 1.15.6.
I created an OS using the below payload. However, the templates are not associated with the OS. So, I had to manually associate the templates in Foreman UI.
The REST API doc https://www.theforeman.org/api/1.15/index.html does not show any parameters to set the default templates for an OS.
How to set default templates using REST API ?
I am using the below JSON payload for creating OS
{
"operatingsystem": {
"name": "redhat7.5",
"major": 7,
"family": "Redhat",
"architecture_ids": [1],
"medium_ids": [1],
"ptable_ids": [1],
"provisioning_template_ids": [11, 20]
}
}
The Foreman API documentation is not really helpful.
I used the
hammer set-default-template
in verbose mode to find the REST API call.Below is the sample code to set the default templates for an OS using REST API