summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-15 20:32:08 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-15 20:32:08 -0700
commit9b48de4bf9f9d061c67cc0961656b95795cbadf7 (patch)
treed08f5ce30fe66ee5aa6ff932a5c1b6c50c966159
parentfcb5b56f8bd89b9321e6d53568ad4baf4792d3ff (diff)
downloadchef-9b48de4bf9f9d061c67cc0961656b95795cbadf7.tar.gz
Add examples to osx_profile
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/osx_profile.rb68
1 files changed, 66 insertions, 2 deletions
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index d1a2791d3c..8939ad506c 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -30,8 +30,72 @@ class Chef
provides :osx_profile
provides :osx_config_profile
- description "Use the **osx_profile** resource to manage configuration profiles (.mobileconfig files) on the macOS platform. The osx_profile resource installs profiles by using the uuidgen library to generate a unique ProfileUUID, and then using the profiles command to install the profile on the system."
+ description "Use the **osx_profile** resource to manage configuration profiles (`.mobileconfig` files) on the macOS platform. The **osx_profile** resource installs profiles by using the uuidgen library to generate a unique `ProfileUUID`, and then using the `profiles` command to install the profile on the system."
introduced "12.7"
+ examples <<~DOC
+ **Install a profile from a cookbook file**
+
+ ```ruby
+ osx_profile 'com.company.screensaver.mobileconfig'
+ ```
+
+ **Install profile from a hash**
+
+ ```ruby
+ profile_hash = {
+ 'PayloadIdentifier' => 'com.company.screensaver',
+ 'PayloadRemovalDisallowed' => false,
+ 'PayloadScope' => 'System',
+ 'PayloadType' => 'Configuration',
+ 'PayloadUUID' => '1781fbec-3325-565f-9022-8aa28135c3cc',
+ 'PayloadOrganization' => 'Chef',
+ 'PayloadVersion' => 1,
+ 'PayloadDisplayName' => 'Screensaver Settings',
+ 'PayloadContent'=> [
+ {
+ 'PayloadType' => 'com.apple.ManagedClient.preferences',
+ 'PayloadVersion' => 1,
+ 'PayloadIdentifier' => 'com.company.screensaver',
+ 'PayloadUUID' => '73fc30e0-1e57-0131-c32d-000c2944c108',
+ 'PayloadEnabled' => true,
+ 'PayloadDisplayName' => 'com.apple.screensaver',
+ 'PayloadContent' => {
+ 'com.apple.screensaver' => {
+ 'Forced' => [
+ {
+ 'mcx_preference_settings' => {
+ 'idleTime' => 0,
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+
+ osx_profile 'Install screensaver profile' do
+ profile profile_hash
+ end
+ ```
+
+ **Remove profile using identifier in resource name**
+
+ ```ruby
+ osx_profile 'com.company.screensaver' do
+ action :remove
+ end
+ ```
+
+ **Remove profile by identifier and user friendly resource name**
+
+ ```ruby
+ osx_profile 'Remove screensaver profile' do
+ identifier 'com.company.screensaver'
+ action :remove
+ end
+ ```
+ DOC
property :profile_name, String,
description: "Use to specify the name of the profile, if different from the name of the resource block.",
@@ -41,7 +105,7 @@ class Chef
description: "Use to specify a profile. This may be the name of a profile contained in a cookbook or a Hash that contains the contents of the profile."
property :identifier, String,
- description: "Use to specify the identifier for the profile, such as com.company.screensaver."
+ description: "Use to specify the identifier for the profile, such as `com.company.screensaver`."
# this is not a property it is necessary for the tempfile this resource uses to work (FIXME: this is terrible)
#