Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
6927637
first commit plistbuddy
Oct 26, 2017
b6cc4f0
all recipe/plist in macos
Oct 26, 2017
ed74b85
extract plistbuddy to resource
Oct 26, 2017
9beca33
Straighten out unit tests
Oct 26, 2017
2bca4d5
first passing test
Oct 26, 2017
b44a023
add more data type tests
Oct 26, 2017
21dddd9
Most data types passing
Oct 26, 2017
70f9d09
More testing
Oct 26, 2017
4a942c3
PlistBuddy and testing update
Oct 26, 2017
f481503
remove extra newline
Oct 26, 2017
9d43d46
add metadata file
Oct 26, 2017
9311a37
edit metadata; add Berksfile
Oct 26, 2017
f16ecae
move Berksfile to correct location
Oct 26, 2017
19645bc
add testing requirements for berks vendor
Oct 26, 2017
ec4b489
move kitchen file
Oct 26, 2017
5328995
Converge passing in test cookbook
Oct 26, 2017
55bed5d
Itempotence
Oct 27, 2017
a493029
Fix false positive?
Oct 27, 2017
92a5e41
Add logic for adding a value
Oct 27, 2017
a734d4a
remove debugging; fix smoke tests
Oct 27, 2017
be648fb
merge master to get up-to-date
Oct 27, 2017
f907c49
remove .kitchen.yml
Oct 27, 2017
43ea52b
bump version to 0.8.5
Oct 28, 2017
07fcc08
unskip ChefSpec tests - they're passing
Oct 29, 2017
7297d6f
mark args_formatter as private method
Oct 29, 2017
41e3037
Merge branch 'develop' into feature/plistbuddy
jazaval Nov 8, 2017
bbe2dfc
Merge pull request #12 from Microsoft/feature/plistbuddy
jazaval Nov 8, 2017
3d2fdf5
Feature/macos user (#14)
americanhanko Dec 1, 2017
174786e
update helper pattern to match current standard; include everywhere
jazaval Dec 5, 2017
27bb087
remove helper reference in Xcode resource
jazaval Dec 5, 2017
d85b9f0
bump version
jazaval Dec 5, 2017
1a43210
update Xcode attribute to latest
jazaval Dec 5, 2017
cfa82a7
extract xcode smoke tests to a different suite
jazaval Dec 5, 2017
b4516ec
update xcversion path for simulators test
jazaval Dec 5, 2017
5461869
update namespace again
jazaval Dec 6, 2017
302cc8a
refactor XcodeHelper modules in XCVersion, Xcode, and XCVersion modules
jazaval Dec 6, 2017
4a135c3
updated method calls for new modules
jazaval Dec 6, 2017
4c68868
bump version
jazaval Dec 6, 2017
9209e48
extract xcversion module to separate library file
jazaval Dec 6, 2017
f4c456b
add missing macos module
jazaval Dec 6, 2017
cb4ea69
include parent module macos instead of child for xcode and xcversion
jazaval Dec 6, 2017
33fd038
update available_simulator_versions to new method
jazaval Dec 6, 2017
a17286f
Merge pull request #16 from Microsoft/hotfix/xcode-helpers
jazaval Dec 7, 2017
0baff89
bump version
jazaval Dec 8, 2017
417a9e6
add platform-specific smoke test for xcode
jazaval Dec 8, 2017
c469799
add xcode test recipe
jazaval Dec 8, 2017
1a4d685
update kitchen with xcode suite
jazaval Dec 8, 2017
34886e9
refactor simulator method to call it's own available list of simulators
jazaval Dec 8, 2017
46aff7d
use new simulator method to find highest available version
jazaval Dec 8, 2017
c353211
move xcode prep work into the setup action
jazaval Dec 8, 2017
ada8f54
clear kitchen customizations
jazaval Dec 9, 2017
0d23c1f
lazily evalutate ios simulator property
jazaval Dec 9, 2017
572a7e1
move lazy evaluation to simulator action in xcode resource
jazaval Dec 9, 2017
d1e442a
revert lazy execution
jazaval Dec 9, 2017
eae24cc
warn and retry if simulator list is empty
jazaval Dec 9, 2017
66434f3
restore spacing
jazaval Dec 9, 2017
4c33b96
more whitespace
jazaval Dec 9, 2017
baf7ff3
refactor highest_semantic_simulator method into class, smaller methods
jazaval Dec 11, 2017
54a5464
implement simulator class
jazaval Dec 11, 2017
35f6caa
add more xcversion command methods
jazaval Dec 11, 2017
eeeb24d
implement xcversion command methods
jazaval Dec 11, 2017
3412dce
implement command methods correctly
jazaval Dec 11, 2017
64f710b
add list methods for xcversion
jazaval Dec 11, 2017
a6b4e2e
implement xcversion list methods
jazaval Dec 11, 2017
79a1150
implement install xcode correctly
jazaval Dec 11, 2017
b10adfb
reorder methods
jazaval Dec 11, 2017
54f2e46
add method to list installed xcodes
jazaval Dec 11, 2017
890c710
use more descriptive name for 'command' method
jazaval Dec 11, 2017
14f8738
move where the space lives
jazaval Dec 11, 2017
393923a
implement installed xcodes command
jazaval Dec 11, 2017
9475020
implement install xcodes correctly
jazaval Dec 11, 2017
d6851c2
Merge pull request #17 from Microsoft/hotfix/simulators_not_found
jazaval Dec 12, 2017
4c797a2
disable downloads prior to disabling software update check
jazaval Dec 12, 2017
e91ddbb
Renamed name to device_name
mjmerin Dec 12, 2017
0dc5137
Change name.rb to machine_name.rb to be similar with the apex
mjmerin Dec 12, 2017
0efb444
Merge pull request #18 from Microsoft/hotfix/el_capitan_swu
americanhanko Dec 12, 2017
f42c1d7
Add new test recipe and smoke test for machine_name.
mjmerin Dec 12, 2017
cc9085d
add disable-swu test suite
jazaval Dec 13, 2017
b148662
Bump up cookbook version numbers.
mjmerin Dec 13, 2017
e48bf8d
Merge pull request #19 from Microsoft/name_resource_fc108
mjmerin Dec 13, 2017
cdcc015
update kitchen test suite order, remove standalone swu testing
jazaval Dec 13, 2017
f2fb70e
implement build definition badge and minor tweaks
americanhanko Dec 14, 2017
3c66d4b
Add descriptions and attribute lists for recipes
americanhanko Dec 14, 2017
bf664a6
Remove 'description' label from recipe names
americanhanko Dec 14, 2017
1b64101
Bump version, add documentation dir
americanhanko Dec 14, 2017
742e731
Fix up the last commit
americanhanko Dec 14, 2017
92b1283
Separate 10.12 and 10.13 build status
americanhanko Dec 14, 2017
2e6a059
Add table for build status
americanhanko Dec 14, 2017
01432c6
Add plist resource documentation
americanhanko Dec 14, 2017
f4d252b
Add Xcode documentation
americanhanko Dec 14, 2017
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ kitchen-tests/vendor

# Visual Studio Code files
.vscode
*/**/*.code-workspace
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
.idea

Expand Down Expand Up @@ -101,3 +102,4 @@ Vagrantfile
.rubocop.yml
.vagrant
data_bags
*.code-workspace
123 changes: 96 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# macOS Cookbook
macOS Cookbook
==============

This cookbook provides:
- Resources for configuring and provisioning macOS.
- Recipes that implement common use-cases of the macOS cookbook's recources.
The macOS cookbook is a Chef library cookbook that provides resources for configuring
and provisioning macOS. Additionally, it provides recipes that implement common
use-cases of the macOS cookbook's recources.

## Platforms
|||
|-|-|
| macOS Sierra 10.12 | ![build-status-1012](https://office.visualstudio.com/_apis/public/build/definitions/59d72877-1cea-4eb6-9d06-66716573631a/2143/badge) |
| macOS High Sierra 10.13 | ![build-status-1013](https://office.visualstudio.com/_apis/public/build/definitions/59d72877-1cea-4eb6-9d06-66716573631a/2140/badge) |
|||

- macOS
Requirements
------------

## Chef
- Only tested on Chef 13
- Surprisingly, this cookbook is only compatible with macOS

- Chef 13+
Supported OS Versions
---------------------

## Attributes
- OS X El Capitan 10.11
- macOS Sierra 10.12
- macOS High Sierra 10.13

Attributes
----------

### Admin User and Password

Expand All @@ -22,33 +35,89 @@ node['macos']['admin_password'] = 'vagrant'
```

Each of these attributes defaults to vagrant since our resources are developed
with the Vagrant paradigm. In other words, the use and password declared here
should be an admin user.
with the Vagrant paradigm. In other words, the user and password declared here
should be an admin user with passwordless super-user rights.

Recipes
-------

### Disable Software Updates

Disables automatic checking and downloading of software updates.

**Usage:** `include_recipe macos::disable_software_updates`

No attributes used in this recipe.

### Keep Awake

Prevent macOS from falling asleep, disable the screensaver, and
several other settings to always keep macOS on. Uses the `plistbuddy` and `pmset`
resources.

**Usage:** `include_recipe macos::keep_awake`

| Attribute used | Default value |
|---------------------------------------|-------------------------|
| `node['macos']['network_time_server']`| `'time.windows.com'` |
| `node['macos']['time_zone']` | `'America/Los_Angeles'` |

### Mono

_TODO_
Installs [Mono](http://www.mono-project.com/docs/about-mono/). Requires package
name, version number, and checksum in order to override.

---
**Usage:** `include_recipe macos::mono`

## Resources
| Attribute used | Default value |
|-------------------------------------|----------------------------------------|
| `node['macos']['mono']['package']` | `'MonoFramework-MDK-4.4.2.11.macos10.xamarin.universal.pkg'` |
| `node['macos']['mono']['version']` | `'4.4.2'` |
| `node['macos']['mono']['checksum']` | `'d8bfbee7ae4d0d1facaf0ddfb70c0de4b1a3d94bb1b4c38e8fa4884539f54e23'` |

- `ard`
- `name`
- `defaults`
- `pmset`
- `systemsetup`
- `xcode`
### Xcode

Checkout the [Wiki](https://github.com/Microsoft/macos-cookbook/wiki) for details about the macOS Cookbook resources.
Installs Xcode 9.1 and simulators for iOS 10 and iOS 11. Check out
the documentation for the Xcode resource if you need more flexibility.

---
:large_orange_diamond: Requires an `apple_id` data bag item.

## Recipes
**Usage:** `include_recipe macos::xcode`

- `disable_software_updates`
- `keep_awake`
- `mono`
- `configurator`
| Attribute Used | Default value |
|---------------------------------------------------------------|---------------|
| `node['macos']['xcode']['version']` | `'9.1'` |
| `node['macos']['xcode']['simulator']['major_version']` | `%w(11 10)` |

### Apple Configurator 2

Installs Apple Configurator 2 using `mas` and links `cfgutil` to
`/usr/local/bin`.

:large_orange_diamond: Requires an `apple_id` data bag item.

**Usage:** `include_recipe macos::configurator`

**Attributes**: No attributes used in this recipe.

#### Data Bags

Both the `macos::xcode` and `macos::configurator` recipes require a data bag
item named `apple_id` containing valid Apple ID credentials. For example:

**Example:**

```json
{
"id": "apple_id",
"apple_id": "farva@spurbury.gov",
"password": "0k@yN0cR34m"
}
```

Resources
---------

- [ARD (Apple Remote Desktop)](./documentation/resource_ard.md)
- [Plist](./documentation/resource_plist.md)
- [Xcode](./documentation/resource_xcode.md)
5 changes: 4 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
default['macos']['mono']['version'] = '4.4.2'
default['macos']['mono']['checksum'] = 'd8bfbee7ae4d0d1facaf0ddfb70c0de4b1a3d94bb1b4c38e8fa4884539f54e23'

default['macos']['xcode']['version'] = '9.0'
default['macos']['xcode']['version'] = '9.1'
default['macos']['xcode']['simulator']['major_version'] = %w(11 10)

default['macos']['network_time_server'] = 'time.windows.com'
default['macos']['time_zone'] = 'America/Los_Angeles'
133 changes: 133 additions & 0 deletions documentation/resource_ard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
ard
===

Use the **ard** resource to manage Remote Desktop settings and preferences.
Under the hood, an **ard** resource executes the `kickstart` command, located
in ARDAgent.app (one of the CoreServices of macOS). It has some basic actions,
which pertain to the simple `kickstart` subcommands. It also has the more
complicated `:configure` action, which requires some familiarity with
`kickstart`.

[Learn more about the `kickstart` command](https://support.apple.com/en-us/HT201710).

Syntax
------

A **ard** resource block declares a basic description of the command configuration
and a set of properties depending on the actions executed. For example:

```ruby
ard 'activate and configure ard' do
action [:activate, :configure]
end
```

where

- `:activate` activates the ARD agent
- `:configure` configures the agent using the `kickstart` defaut commandline arguments.

The full syntax for all of the properties that are available to the **ard**
resource is:

```ruby
ard 'description' do
install_package String
uninstall_options Array, # defaults to ['-files', '-settings', '-prefs'] if not specified
restart_options Array, # defaults to ['-agent', '-console', '-menu'] if not specified
users Array
privs Array, # defaults to ['-all'] if not specified
access String, # defaults to '-on' if not specified
allow_access_for String, # defaults to '-allUsers' if not specified
computerinfo Array
clientopts Array
action Symbol # defaults to [:activate, :configure] if not specified
end
```

**Note:** Not all properties are compatible with each action.

Actions
-------

This resource has the following actions:

`:activate`

      Activate the remote desktop agent.

`:deactivate`

      Deactivate the remote desktop agent.

`:uninstall`

      Uninstall a package from another remotely
managed mac.

`:stop`

      Stop the agent.

`:restart`

      Restart the remote desktop agent.

`:configure`

      Configure the setup of the remote desktop
agent using the default options. If you were to configure the default options,
your settings would look like this in the GUI:

Properties
----------

`install_package`

      **Ruby Type:** `String`

`uninstall_options`

      **Ruby type:** `Array`

      default options: `['-files', '-settings', '-prefs']`

`restart_options`

      **Ruby type:** `Array`

      default options: `['-agent', '-console', '-menu']`

`users`

      **Ruby type:** `Array`

`privs`

      **Ruby type:** `Array`

      default: `['-all']`

`access`

      **Ruby type:** `String`

      default: `'-on'`

`allow_access_for`

      **Ruby type:** `String`

      default: `'-allUsers'`

`computerinfo`

      **Ruby type:** `Array`

`clientopts`

      **Ruby type:** `Array`

`action`

      **Ruby type:** `Symbol`
64 changes: 64 additions & 0 deletions documentation/resource_plist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
plist
=====

Use the **plist** resource to manage property list files (plists) and their content.
A **plist** resource instance represents the state of a single key-value pair in
the delared plist `path`. Since each plist resource instance represents only one
setting, you may end up with several plist resource calls in a given recipe. Although
this may seem like overkill, it allows us to have a fully idempotent resource with
fine granularity.

During the `chef-client` run, the client knows to check the state of the plist
before changing any values. It also makes sure that the plist is in binary format
so that the settings can be interpreted correctly by the operating system.

Prior knowledge of using commandline utilities such as `/usr/bin/defaults`
and `/usr/libexec/PlistBuddy` will be useful when implementing the
**plist** resource.

[Learn more about property lists.](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/PropertyLists/QuickStartPlist/QuickStartPlist.html#//apple_ref/doc/uid/10000048i-CH4-SW5)

Syntax
------

The full syntax for all of the properties that are available to the **plist**
resource is:

```ruby
plist 'description' do
path String # defaults to 'description' if not specified
entry String
value TrueClass, FalseClass, String, Integer, Float
action Symbol # defaults to :set if not specified
end
```

Actions
-------

This resource has the following actions:

`:set`

      Set `entry` to `value` in `path`

Examples
--------

Enabling the setting to show both visible and invisible files.

```ruby
plist 'show hidden files' do
path '/Users/vagrant/Library/Preferences/com.apple.finder.plist'
entry 'AppleShowAllFiles'
value true
end
```

where

`path` is the absolute path to the `com.apple.finder.plist` plist file

`entry` is the representing the plist entry `'AppleShowAllFiles'`

`value` is the entry's value to boolean type: `true`
Loading