forked from ryanycoleman/rcoleman-mac_profiles_handler
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,54 @@ | ||
# manage mac profiles | ||
define mac_profiles_handler::manage( | ||
$file_source, | ||
$ensure, | ||
$file_source = '', | ||
$ensure = 'present', | ||
$type = 'mobileconfig', | ||
) { | ||
|
||
if $facts['os']['name'] != 'Darwin' { | ||
fail('The mobileconfig::manage resource type is only supported on OS X') | ||
fail('The mobileconfig::manage resource type is only supported on macOS') | ||
} | ||
|
||
File { | ||
owner => 'root', | ||
group => 'wheel', | ||
mode => '0700', | ||
} | ||
|
||
if ! defined(File["${facts['puppet_vardir']}/mobileconfigs"]) { | ||
file { "${facts['puppet_vardir']}/mobileconfigs": | ||
ensure => directory, | ||
} | ||
} | ||
case $type { | ||
'template': { | ||
file { "${facts['puppet_vardir']}/mobileconfigs/${name}": | ||
ensure => file, | ||
content => $file_source, | ||
case $ensure { | ||
'absent': { | ||
profile_manager { $name: | ||
ensure => $ensure, | ||
} | ||
} | ||
default: { | ||
file { "${facts['puppet_vardir']}/mobileconfigs/${name}": | ||
ensure => file, | ||
source => $file_source, | ||
File { | ||
owner => 'root', | ||
group => 'wheel', | ||
mode => '0700', | ||
} | ||
} | ||
} | ||
|
||
profile_manager { $name: | ||
ensure => $ensure, | ||
profile => "${facts['puppet_vardir']}/mobileconfigs/${name}", | ||
require => File["${facts['puppet_vardir']}/mobileconfigs/${name}"], | ||
subscribe => File["${facts['puppet_vardir']}/mobileconfigs/${name}"], | ||
if ! defined(File["${facts['puppet_vardir']}/mobileconfigs"]) { | ||
file { "${facts['puppet_vardir']}/mobileconfigs": | ||
ensure => directory, | ||
} | ||
} | ||
case $type { | ||
'template': { | ||
file { "${facts['puppet_vardir']}/mobileconfigs/${name}": | ||
ensure => file, | ||
content => $file_source, | ||
} | ||
} | ||
default: { | ||
file { "${facts['puppet_vardir']}/mobileconfigs/${name}": | ||
ensure => file, | ||
source => $file_source, | ||
} | ||
} | ||
} | ||
profile_manager { $name: | ||
ensure => $ensure, | ||
profile => "${facts['puppet_vardir']}/mobileconfigs/${name}", | ||
require => File["${facts['puppet_vardir']}/mobileconfigs/${name}"], | ||
subscribe => File["${facts['puppet_vardir']}/mobileconfigs/${name}"], | ||
} | ||
} | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "puppet-mac_profiles_handler", | ||
"author": "", | ||
"license": "", | ||
"version": "2.0.0", | ||
"summary": "Puppet Module for managing macOS Configuration Profiles", | ||
"source": "https://github.com/keeleysam/puppet-mac_profiles_handler", | ||
"project_page": "https://github.com/keeleysam/puppet-mac_profiles_handler", | ||
"issues_url": "https://github.com/keeleysam/puppet-mac_profiles_handler/issues", | ||
"tags": [ | ||
"macOS", | ||
"OS X", | ||
"mobileconfig", | ||
"profiles" | ||
], | ||
"operatingsystem_support": [ | ||
{ | ||
"operatingsystem": "Darwin" | ||
} | ||
], | ||
"requirements": [ | ||
{ | ||
"name": "puppet", | ||
"version_requirement": ">= 4.4.0" | ||
} | ||
], | ||
"dependencies": [ | ||
{ | ||
"name": "puppetlabs/stdlib", | ||
"version_requirement": ">= 2.3.1" | ||
} | ||
] | ||
} |