-
Notifications
You must be signed in to change notification settings - Fork 38
Groups and Scope
You may specify any number of static and smart groups to scope your policy to (including none). The groups
input variable should be an array of group dictionaries. Each group dictionary needs a name. Additionally, the optional smart
property should be True
, and you will need to include the path, template_path
, to an XML template for your smart group.
Static groups need only a name.
Here is an example groups
array from the jss-recipes repo:
<key>groups</key>
<array>
<dict>
<key>name</key>
<string>%GROUP_NAME%</string>
<key>smart</key>
<true/>
<key>template_path</key>
<string>%GROUP_TEMPLATE%</string>
</dict>
</array>
JSSImporter can use group exclusions in its scope as well. Specify an exclusion_groups
array of group dictionaries exactly as per groups above to do so.
Here is an example exclusion_groups
array:
<key>exclusion_groups</key>
<array>
<dict>
<key>name</key>
<string>%EXCLUSION_GROUP_NAME%</string>
<key>smart</key>
<true/>
<key>template_path</key>
<string>%EXCLUSION_GROUP_TEMPLATE%</string>
</dict>
</array>
Smart groups require an XML template, but, like for policies, the template can do some variable substitution, so you can often get away with a single template file for all of your recipes. The easiest way to see the correct XML structure for a smart group is to create one in the web interface, and then look it up with the api at https://yourjamfproserver:8443/api/#!/computergroups/findComputerGroupsByName_get
Here is an example of a smart group template:
<computer_group>
<name>%GROUP_NAME%</name>
<is_smart>true</is_smart>
<criteria>
<criterion>
<name>Application Title</name>
<priority>0</priority>
<and_or>and</and_or>
<search_type>is</search_type>
<value>%JSS_INVENTORY_NAME%</value>
</criterion>
<criterion>
<name>Application Version</name>
<priority>1</priority>
<and_or>and</and_or>
<search_type>is not</search_type>
<value>%VERSION%</value>
</criterion>
<criterion>
<name>Computer Group</name>
<priority>2</priority>
<and_or>and</and_or>
<search_type>member of</search_type>
<value>Testing</value>
</criterion>
</criteria>
</computer_group>
This smart group applies to computers who are members of the Testing static group, who don't have the latest version of the app in question. You can see how, like elsewhere in AutoPkg recipes, variable substitution occurs with a %wrapped%
variable name.
For smart groups which use the Application Title
criterion, you have to be careful. The JSS inventory seems to be based on the filenames of the apps in /Applications
only. The %JSS_INVENTORY_NAME%
template variable / %jss_inventory_name%
recipe input variable needs to be the name the JSS uses for its Application Title
value, which in some cases differs from what the app is commonly called. You can look this up by creating a new smart group in the web interface, adding a criteria of Application Title
is
and then hit the ellipses button to see all of the inventoried apps.
So "Google Chrome.app" and "Goat Simulator.app" may be the inventory name, even though you would want your package name to be GoogleChrome and GoatSimulator.
NOTE: If you don't specify a %jss_inventory_name%
input variable, the JSSImporter will add '.app' to the product name, since this is the case for most apps. Only specify %jss_inventory_name%
when you want to override the automatic behavior.
See the "Template" section for a list of all of the string replacement variables.
NOTE: Applications that don't install into /Applications
will not be available for "Application Title" criteria. The best solution is to create an extension attribute that returns the version number of the app in question and use that value in your smart group criteria. If you look at the Adobe Flash Player, Silverlight, or Oracle Java 7 recipes in the jss-recipes repo, there are examples of how to solve this problem.
You can of course also/instead set the Computer Management/Computer Inventory Collection/Software/Plug-ins setting in Casper to "Collect Plug-ins", which should already know the right path to check for Internet Plugins.
Other questions not addressed here? Join us in the #jss-importer channel on the Mac Admins Slack.