Creating classes and assigning them in Foreman

Using Foreman 1.24 with latest Puppet 6.13 from Puppetlabs repositories, running the server and agents on Ubuntu 16.04. Just tinkering about with creating puppet classes in the default production environment in /etc/puppetlabs/code/environments/production. Surely, I can create some puppet classes directly under manifests, with each class in its own file, then import the classes, and assign to host groups in Foreman. However, should I rather be creating classes as Puppet modules then importing them?

Sorry for the confusion. I am just trying to get a good overview on how to do it in the CLI, together with the Foreman GUI and getting to know “best practices” .

Foreman doesn’t allow creation and management of puppet modules, only importing puppet classes from the existing puppet environments. It can import multiple classes from the same module if there are such. How to structure your puppet classes and modules depends on your usage and is not Foreman specific.