You may sometimes script preferences using defaults write commands (don’t edit the .plist files with a text editor directly). For example, you might change Munki client preferences using a command like:
There are several methods to get or generate .mobileconfig profiles. I’m listing them below in order of preference from top recs to not-to-top recs.
Just finding existing profiles
Chances are if you want to manage a setting, someone else has also wanted at some point to manage that setting. site:github.com mobileconfig is a great Google search for finding those.
Using mcxToProfile to generate a profile
You can create .mobileconfig profiles from existing .plist preference files you already have on a sample client machine. Just download Tim Sutton’s mcxToProfile.
Then you can run something like
Generating Profiles with Apple Configurator
Apple Configurator is another option.
The code it produces is (like mcxToProfile’s) clean and easy to edit. And, yes, you usually want to edit down .mobileconfig profiles to be only the things you actually want to manage. Omit (i.e., delete) anything that you want your users to be able to manage themselves.
Generating profiles with Profile Manager
If you’re using Server.app, there’s a built-in way to generate profiles.
Update: Apparently, you can tidy up the XML fairly easily if you want. Thanks to Ian Vonesh for the tip.
Whichever method you use, though, you can just import the .mobileconfig directly into Munki and push it out to your clients (be sure to test for unexpected behavior first before moving to production).