Skip to content
Graham R Pugh edited this page Mar 15, 2019 · 5 revisions

To see a list of input variables, use autopkg processor-info JSSImporter.

Ultimately, the JSSImporter is about crafting Jamf Pro policies. However, policies require a number of other pieces of information: which computer groups to scope the policy to, what category the policy should be managed under, the category of the package, any scripts to include, and potentially many other policy settings, like whether to run a recon or not.

Recipes may be somewhat confusing to put together at first. Have a look at the AutoPkg org's JSS recipes to see it all in action.

A smart group template (SmartGroupTemplate.xml) and a policy template (PolicyTemplate.xml) are included in this project to give you a place to start. These are in the example_templates folder of the JSSImporter repository.

Using Overrides

.jss recipes following the standard templates are designed to allow you to use overrides to change the major input variables. However, if you do use overrides (which you absolutely should!), you have to undertake some additional work. Since the override recipe lives in your ~/Library/AutoPkg/RecipeOverrides/ folder, the %RECIPE_DIR% substitution in those recipes now points to the RecipeOverrides folder rather than the base .jss recipe's folder. You will therefore need to copy all of the recipe's needed support files: templates, scripts, and icons, to the override directory.

Note: you will need to copy the default SmartGroupTemplate.xml and PolicyTemplate.xml to the RecipeOverrides folder.

Filenames and Paths

For any argument to JSSImporter that requires a filename, you may use just a filename, or a full path to that file. Since these values often contain substitution variables (e.g. %RECIPE_DIR%) or may be overridden, JSSImporter follows a set series of search directories until it finds the filename specified.

These directories are:

  1. The path as specified.
  2. The parent folder of the path.
  3. First ParentRecipe's folder.
  4. First ParentRecipe's parent folder.
  5. Second ParentRecipe's folder.
  6. Second ParentRecipe's parent folder.
  7. Nth ParentRecipe's folder.
  8. Nth ParentRecipe's parent folder.

This searching applies to policy_template, computer group templates, self_service_icon, scripts and script templates, and extension attribute templates.

It allows users to avoid having to copy the file to the override directory for each recipe. It also allows users to structure a repository of JSS recipes in subfolders, without having to copy shared support files into each product's subdirectory.

Note that this doesn't work when working with Recipe Overrides.

Note on Objects

The default behaviour of JSSImporter is to overwrite the JSS objects at every AutoPkg run, regardless of whether anything has changed. This is by design, but may be a surprise if you try to edit, say, a policy, by hand after the JSSImporter creates it.

Specifically, objects that get recreated every run:

  • Extension Attributes
  • Scripts
  • Smart Groups
  • Policy

This way, you can ensure that what is specified in the recipe is what is on the JSS. However, if your workflow involves removing a Testing policy when it goes into production, you will find the Testing policy reappears.

Researching your JSS

While setting this all up, you will probably want to see some valid XML straight from the horse's mouth. There are a few ways to look at the XML directly:

  1. The API documentation on your JSS includes a web interface for looking things up. Just add /api to your JSS's web address, i.e. https://yourjamfproserver.org:8443/api
  2. The jss_helper gives you a simple command line utility for querying the relevant objects.
  3. python-jss is a python wrapper around the JSS API which will allow easy access to all objects on the JSS.