Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ A structured fact is also provided to list installed profiles along with some me

## Usage

> Local profile installation is non-functional on macOS 11 and newer. Use the method => 'mdm' below.

<pre>
mac_profiles_handler::manage { 'com.puppetlabs.myprofile':
ensure => present,
Expand Down Expand Up @@ -39,7 +41,7 @@ You must pass the profilers identifier as your namevar, ensure accepts present o

### Profile installation via MicroMDM and MDMDirector

Profiles can be sent via MDMDirector and compatible tools. Add your configuration to Hiera (`eyaml` recommended for secrets). Only template style profiles are supported.
Profiles can be sent via MDMDirector and compatible tools. Add your configuration to Hiera (`eyaml` recommended for secrets).

<pre>
# MDMDirector information
Expand All @@ -50,14 +52,34 @@ mac_profiles_handler::mdmdirector_username: mdmdirector
mac_profiles_handler::method: mdm
</pre>

Or you can install only some profiles via MDM

You can install profiles with a mobileconfig file in the module or an ERB template.

<pre>
mac_profiles_handler::manage { 'com.puppetlabs.myprofile':
ensure => present,
file_source => 'puppet:///modules/mymodule/com.puppetlabs.myprofile.mobileconfig',
method => 'mdm'
}
</pre>

<pre>
mac_profiles_handler::manage { 'com.puppetlabs.myprofile':
ensure => present,
file_source => template('mymodule/com.puppetlabs.myprofile.erb'),
type => 'template',
method => 'mdm' # or set this to 'local'
method => 'mdm'
}
</pre>

When ensuring a profile is removed, you must also provide the file_source and method.

<pre>
mac_profiles_handler::manage { 'com.puppetlabs.myprofile':
ensure => absent,
file_source => template('mymodule/com.puppetlabs.myprofile.erb'),
type => 'template',
method => 'mdm'
}
</pre>

Expand Down
15 changes: 5 additions & 10 deletions manifests/mdm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@

$enrolled = $facts['mdmenrollment']['mdm_enrolled']

if $type != 'template' {
if 'puppet:///modules/' in $file_source {
$munged_source = inline_template('<%= @file_source[18..-1] %>')
notify{$munged_source: }
$input = file($munged_source)
}
else {
$input = $file_source
}
if 'puppet:///modules/' in $file_source {
$munged_source = inline_template('<%= @file_source[18..-1] %>')
notify{$munged_source: }
$input = file($munged_source)
} else {
$input = $file_source
}
Expand All @@ -28,7 +23,7 @@
}
}

if $enrolled and $type == 'template' {
if $enrolled {

$profiles = $facts['profiles']

Expand Down