Foreman API | import puppet classes with Environment

Hi,

I have just started using foreman and it's API's. I'm looking for How to
create a class and assign it to an environment.

I can create a puppet class using Foreman API, but could not get how to
assign to environment.

Ex: puppet_testclass in "production" environment.

POST /api/puppetclasses
{
"puppetclass": {
"name": "test_class3"
}
}

Thanks

You may be able to assign the class to an environment through the API
(e.g. by setting "environment_names": ["production"]), but this is the
wrong way to set up classes in Foreman. The classes should be put onto
the Puppet master and imported into Foreman.

Please see
https://groups.google.com/forum/#!topic/foreman-users/D4ZejHdkTZo as
it's almost the same question and answer.

··· On 12/05/16 18:09, Harish Kothuri wrote: > Hi, > > I have just started using foreman and it's API's. I'm looking for How to > create a class and assign it to an environment. > > I can create a puppet class using Foreman API, but could not get how to > assign to environment. > > Ex: puppet_testclass in "production" environment. > > POST /api/puppetclasses > { > "puppetclass": { > "name": "test_class3" > } > }


Dominic Cleal
dominic@cleal.org