Hi,
I have a question about smart class parameters. I want to provision hosts
automatically with foreman and puppet. All the installation process is done
by Kickstart and Puppet. I want to store all configuration information in
Foreman.
I made parametrized classes in Puppet. So the job to be done is to
associate classes to hosts and fill in the parameters in the puppet classes.
I want that to be done automatically, so i have to use the API to do that
job.
I succecced in associating puppet classes to hosts with
/api/hosts/machine_id/puppetclass_ids
BUT i don't see how to overrides the default puppet class parameters with
the API. My question is how can i do that?
I have seen the "override_values" method API but i don't know what
:smart_class_parameter_id to provide. Is it the good way to do the job? But
HOW?
Thanks in advance for your help
Best regards,
J.F.
Hi,
we use the API to configure systems with a process engine. Here are some
rest calls:
get all available puppetclasses (we need the id to set smartclass
parameters)
curl -k -u username:password -H 'Accept:application/json,version=2'
https://foreman_server/api/puppetclasses
get host puppet classes (if you need to check if a class is already
assigned to a host)
curl -k -u username:password -H 'Accept:application/json,version=2'
https://foreman_server/api/hosts/target_server/puppetclass_ids
add puppet class to hosts (get class ids from above)
curl -k -u username:password -H "Accept: version=2,application/json" -H
"Content-Type: application/json" -d '{"puppetclass_id":"280"}' -X POST
https://foreman_server/api/hosts/testhost11.ide.int.com/puppetclass_ids
get smart class parameters for a class (to get the smartclass parameter
ids)
curl -k -u username:password -H 'Accept:application/json,version=2'
https://foreman_server/api/environments/dev/puppetclasses/305/smart_class_parameters
set smart class parameters for one host
curl -k -u username:password -H "Accept: version=2,application/json" -H
"Content-Type: application/json" -X POST -d '{"override_value": {"match":
"fqdn=target_server","value": "An entry that doesnt make sense."}}'
https://foreman_server/api/smart_class_parameters/902/override_values
Best regards,
Stef
ยทยทยท
On Thursday, February 26, 2015 at 8:20:35 PM UTC+1, jf bette wrote:
>
> Hi,
>
> I have a question about smart class parameters. I want to provision hosts
> automatically with foreman and puppet. All the installation process is done
> by Kickstart and Puppet. I want to store all configuration information in
> Foreman.
> I made parametrized classes in Puppet. So the job to be done is to
> associate classes to hosts and fill in the parameters in the puppet classes.
>
> I want that to be done automatically, so i have to use the API to do that
> job.
> I succecced in associating puppet classes to hosts with
> /api/hosts/machine_id/puppetclass_ids
>
> BUT i don't see how to overrides the default puppet class parameters with
> the API. My question is how can i do that?
> I have seen the "override_values" method API but i don't know what
> :smart_class_parameter_id to provide. Is it the good way to do the job? But
> HOW?
>
> Thanks in advance for your help
>
> Best regards,
>
> J.F.
>