I am aware that it is pretty simple to programmatically add new apps to Splunk's Deployment Server, as you must simply drop them in the right directory and invoke a reload of the service.
For server classes however, this does not seem so trivial. The official documentation asks us to add apps to a server class manually, from the user interface. This I don't like much as it is error prone and non reproducible.
Is there any way (or magic location in the Deployment Server's filesystem, like for the apps), where I can drop the configuration of a server class, for it to be loaded in the graphical UI automatically? This will allow me to configure some simple Ansible/Puppet/Chef... task to take care of those files.
I'm not sure that you can reload serverclasses.conf file without restarting Splunk on the Deployment Server, you can change apps but not conf files.
Anyway, I don't like to modify conf files by program because you need to restart Splunk and you have the risk to loose control on your deployment.
My hint is alway to design your deployment on paper (or Excel) and use the GUi interface to apply them.
I found a customer that used to modify ServerClasses only by SSH, but always manually, not by program and it was a very singular situation for the competence and the mental order of the user.
In few words, this customer had a very complex distributedd architecture so this use manually modified the serverclasses.conf file adding rows and rows of information in the conf file itself,
In conclusion I don't hint to follow your approach, but you have to choose your own best approach.