-
Notifications
You must be signed in to change notification settings - Fork 41
JamfRecipeMaker
JamfRecipeMaker
is an AutoPkg pre- or post-processor designed to write a .jamf
recipe based on information gathered during the run of an existing recipe. It currently supports the following recipe types:
-
.pkg
recipes -
.jss
recipes
It is able to output the following recipe types:
-
-pkg-upload.jamf
recipes: these recipes will upload a package to Jamf Pro. A supplied package category is added to the package data. Optionally, the category will be created if not already existing on the Jamf server. -
.jamf
recipes: these recipes will upload a package to Jamf Pro, and create a smart group and a policy. These are functionally equivalent to "standard".jss
recipes. A supplied package category is added to the package data, and a category and icon are added to the policy. Optionally, the categories will be created if not already existing on the Jamf server. TheVersionRegexGenerator
processor can also be optionally added.
Run a .pkg
or .jss
recipe from the command line, and add JamfRecipeMaker
as a pre-processor or post-processor.
Here we are running Flux.pkg
and generating Flux-pkg-upload.jamf
in the current directory:
autopkg run Flux.pkg --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
Note that you are actually running the recipe - the package will be downloaded to your computer. As with any recipe, you need to have added the repo containing the recipe to run it.
You may also run the recipe as a pre-processor. In this case, the recipe is created at the start of the run, so it doesn't need to complete. This also means you can run in check-only mode (-c
) to speed things up.
autopkg run -c Flux.pkg --pre com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
This will create a recipe with the default identifier-prefix of com.github.autopkg.grahampugh-recipes
. You probably want to change this. You can do this with the RECIPE_IDENTIFIER_PREFIX
key:
autopkg run Flux.pkg --key RECIPE_IDENTIFIER_PREFIX=com.company.recipes --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
To make a full .jamf
recipe which is completely equivalent to "standard" .jss
recipes, set the make_policy
key to True
.
It is advisable to run an existing .jss
recipe to make a .jamf
recipe, so that the values of SELF_SERVICE_DESCRIPTION
and POLICY_CATEGORY
can be obtained automatically:
autopkg run Flux.jss --key make_policy=True --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
Please note that the
JamfRecipeMaker
does not currently check the existing.jss
recipe for scripts, extension attributes or other non-standard settings. This is because scripts and extension attributes are handled in a very different way in.jamf
recipes in comparison to.jss
recipes, so these recipes need to be developed manually. However, the auto-generated recipe can still be useful as a basis for adding the script and/or extension attribute, or any other app-specific settings.
To ensure the categories specified in the recipe will be created if they don't exist, set the make_categories
key to True
:
autopkg run Flux.pkg --key make_categories=True --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
The default output directory is .
, that is, whatever directory you are running autopkg
in. This can be overridden with the RECIPE_OUTPUT_PATH
key:
autopkg run Flux.pkg --key RECIPE_OUTPUT_PATH=/path/to/my/recipe-repo/Jamf_Pkg_Upload_Recipes --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
Recipes are created in YAML format by default. The recipe filename is automatically generated based on the NAME
key, with spaces removed, for example if the name is Microsoft PowerPoint
, the recipe filename will become MicrosoftPowerPoint-pkg-upload.jamf.recipe.yaml
, or if make_policy
is set to True
, the filename will be MicrosoftPowerPoint.jamf.recipe.yaml
.
If you would prefer to create recipes in PLIST format, set the format
key to plist
:
autopkg run Microsoft\ PowerPoint.jss --key format=plist --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
In this case, a PLIST recipe is created and the recipe filename will become MicrosoftPowerPoint-pkg-upload.jamf.recipe
. If make_policy
is set to True
, the filename will be MicrosoftPowerPoint.jamf.recipe
.
If you have an existing recipe list of .jss
recipes, simply run the list with the post-processor and all recipes will be created at once.
autopkg run --recipe-list /path/to/my-jss-recipe-list.txt --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
Note that if this is run as a post-processor, it will not run if the recipe has failed or been stopped, for example if there is no new package and STOP_IF_NO_JSS_UPLOAD
is not set to False
. To overcome the latter, run as a pre-processor.
autopkg run --recipe-list /path/to/my-jss-recipe-list.txt --pre com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
Alternatively, you can set STOP_IF_NO_JSS_UPLOAD
to False
in your run - but be aware that this will overwrite existing policies and smart groups on your Jamf Pro server.
autopkg run --recipe-list /path/to/my-jss-recipe-list.txt --key STOP_IF_NO_JSS_UPLOAD=False --post com.github.grahampugh.recipes.commonprocessors/JamfRecipeMaker
The JamfRecipeMaker
processor assumes a default smart group template exists in the same repo as the generated recipe, named JamfSmartGroupTemplate.xml
, and that a default policy template named JamfPolicyTemplate.xml
also exists in the same repo. These values can be overridden, however.
You can add any of the keys mentioned above into your autopkg preferences file, so that you don't have to add --key X=Y
every time. Use the defaults
command to add your defaults into the autopkg
prefs:
defaults write ~/Library/Preferences/com.github.autopkg.plist RECIPE_OUTPUT_PATH /path/to/my/recipe-repo/Jamf_Recipes
defaults write ~/Library/Preferences/com.github.autopkg.plist RECIPE_IDENTIFIER_PREFIX com.acme.autopkg-recipes
defaults write ~/Library/Preferences/com.github.autopkg.plist make_policy -bool YES
defaults write ~/Library/Preferences/com.github.autopkg.plist make_categories -bool YES
defaults write ~/Library/Preferences/com.github.autopkg.plist format plist