Giter Club home page Giter Club logo

puppet-osx's Introduction

OSX Defaults Module for Puppet

Build Status

Provides classes for setting various defaults in Mac OS X. Also provides a means to set a "recovery message" to be displayed on the login and lock screens.

Recovery Message Usage

Displays the given message on the lock and login screens.

osx::recovery_message { 'If this Mac is found, please call 123-456-7890': }

One-Shot Settings

Just include any of these in your manifest.

Global Settings

  • osx::global::disable_key_press_and_hold - disable press-and-hold for accented character entry
  • osx::global::enable_keyboard_control_access - enables the keyboard for navigating controls in dialogs
  • osx::global::enable_standard_function_keys - enables the F1, F2, etc. keys to be treated as standard function keys
  • osx::global::expand_print_dialog - expand the print dialog by default
  • osx::global::expand_save_dialog - expand the save dialog by default
  • osx::global::disable_remote_control_ir_receiver - disable remote control infrared receiver
  • osx::global::disable_autocorrect - disables spelling autocorrection
  • osx::global::tap_to_click - enables tap to click
  • osx::global::enable_dark_mode - enables "dark mode"
  • osx::global::enable_dark_mode_shortcut - enables command + option + control + t to toggle "dark mode"

Dock Settings

  • osx::dock::2d - use the old flat dock style
  • osx::dock::autohide - automatically hide the dock
  • osx::dock::clear_dock - ensures the dock only contains apps that are running
  • osx::dock::disable - disable the dock by setting a long autohide-delay
  • osx::dock::disable_dashboard - disable the dashboard
  • osx::dock::dim_hidden_apps - dims icons of hidden apps
  • osx::dock::hide_indicator_lights - remove the indicator lights below running apps

Finder Settings

  • osx::finder::show_external_hard_drives_on_desktop
  • osx::finder::show_hard_drives_on_desktop
  • osx::finder::show_mounted_servers_on_desktop
  • osx::finder::show_removable_media_on_desktop
  • osx::finder::show_all_on_desktop - does all of the above
  • osx::finder::empty_trash_securely - enable Secure Empty Trash
  • osx::finder::unhide_library - unsets the hidden flag on ~/Library
  • osx::finder::show_hidden_files
  • osx::finder::enable_quicklook_text_selection
  • osx::finder::show_warning_before_emptying_trash
  • osx::finder::show_warning_before_changing_an_extension
  • osx::finder::show_all_filename_extensions
  • osx::finder::no_file_extension_warnings

Universal Access Settings

  • osx::universal_access::ctrl_mod_zoom - enables zoom by scrolling while holding Control
  • osx::universal_access::enable_scrollwheel_zoom - enables zoom using the scroll wheel

Safari Settings

  • include osx::safari::enable_developer_mode - enables developer mode in safari

Miscellaneous Settings

  • osx::disable_app_quarantine - disable the downloaded app quarantine
  • osx::no_network_dsstores - disable creation of .DS_Store files on network shares
  • osx::software_update - download and install software updates
  • osx::keyboard::capslock_to_control - remaps capslock to control on attached keyboards

Customizable Settings

These settings can be used like one-shots or customized.

osx::global::key_repeat_delay - the amount of time (in ms) before a key starts repeating

# Set the default value (35)
include osx::global::key_repeat_delay

# ... or set your own
class { 'osx::global::key_repeat_delay':
  delay => 10
}

osx::global::key_repeat_rate - the amount of time (in ms) before key repeat 'presses'

# Set the default value (0)
include osx::global::key_repeat_rate

# ... or set your own
class { 'osx::global::key_repeat_rate':
  rate => 2
}

osx::global::natural_mouse_scrolling - enable/disable 'natural' mouse scrolling. Requires re-login for new settings to initialize.

# Set the default value (enabled=true)
include osx::global::natural_mouse_scrolling

# ... or set your own
class { 'osx::global::natural_mouse_scrolling':
  enabled => false
}

osx::universal_access::cursor_size - the amount the cursor will be zoomed

# Set the default value (1.5)
include osx::universal_access::cursor_size

# ... or set your own
class { 'osx::universal_access::cursor_size':
  zoom => 2
}

osx::dock::icon_size - the size of the dock icons, in pixels

# Set the default value (36)
include osx::dock::icon_size

# ... or set your own
class { 'osx::dock::icon_size':
  size => 36
}

osx::dock::position - the location of the dock on the screen ('right', 'left', 'top', 'bottom')

# Set the default value ('right')
include osx::dock::position

# ... or set your own
class { 'osx::dock::position':
  position => 'right'
}

osx::dock::pin_position - the location to pin the dock to ('start', 'middle', 'end')

# Set the default value ('start')
include osx::dock::pin_position

# ... or set your own
class { 'osx::dock::pin_position':
  position => 'start'
}

osx::dock::hot_corner - configure the action for a hot corner

# Make the top left corner display the Dashboard
osx::dock::hot_corner { 'Top Left':
  action => 'Dashboard'
}

# Make the bottom right corner show the desktop
osx::dock::hot_corner { 'Show the desktop':
  position => 'Bottom Right',
  action => 'Desktop'
}

osx::dock::hot_corners - configure the hot corners

# Make the top right corner start the screen saver and the bottom left corner launch Mission Control
class { 'osx::dock::hot_corners':
  top_right => "Start Screen Saver",
  bottom_left => "Mission Control"
}

osx::sound::interface_sound_effects - enable interface sound effects (true, false)

# Set the default value (true)
include osx::sound::interface_sound_effects

# ... or set your own
class { 'osx::sound::interface_sound_effects':
  enable => false
}

osx::mouse::button_mode - the button mode for multitouch mice (1, 2) Requires re-login for new settings to initialize.

# Set the default mode (1)
include osx::mouse::button_mode

# ... or set your own
class { 'osx::mouse::button_mode':
  mode => 2
}

osx::mouse::smart_zoom - enable/disable smart zoom for multitouch mice Requires re-login for new settings to initialize.

# Set the default value (enabled=false)
include osx::mouse::smart_zoom

# ... or set your own
class { 'osx::mouse::smart_zoom':
  enabled => true
}

osx::mouse::swipe_between_pages - enable/disable swipe between pages for multitouch mice Requires re-login for new settings to initialize.

# Set the default value (enabled=false)
include osx::mouse::swipe_between_pages

# ... or set your own
class { 'osx::mouse::swipe_between_pages':
  enabled => true
}

osx::dock::magnification - size of dock icon magnification

# Set the default value (true, 128)
include osx::dock::magnification

# ... or set your own
class { 'osx::dock::magnification':
  magnification => true,
  magnification_size => 84
}

Required Puppet Modules

  • boxen
  • puppetlabs-stdlib

Developing

Write code.

Run script/cibuild.

puppet-osx's People

Contributors

andrewgarner avatar billyvg avatar blackjid avatar bleything avatar britto avatar cedricfinance avatar chrisbobo avatar dgoodlad avatar fromonesrc avatar indirect avatar jacobbednarz avatar jhaals avatar johncolvin avatar johndbritton avatar joshua avatar jsyeo avatar mcauser avatar michaelavila avatar ocxo avatar rafaelfranca avatar rodjek avatar sankage avatar skalnik avatar sodiumjoe avatar tarebyte avatar tekkub avatar thewellington avatar wfarr avatar xdissent avatar yuhunglin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-osx's Issues

About pull request #12

Hi, jfelchner's folk code is very useful for me. The pull request is #12.

I want to merge trunk this pull request, but some problems here.

  1. Some manifest is now duplicate.
  2. A lot of use ensure class parameter. I think that manifest class name is disable_xxx or enable_xxx etc...
  3. Too large pull request.

I try to merge code this pull request, but I have some question about puppet-osx manifest.

  1. Coding rule is exists?

example1: End of last paraemter is ; or , ? Like this.

  boxen::osx_defaults { 'Enable foo':
    user   => $::boxen_user,
    key    => 'fooKey',
    domain => 'com.apple.bar',
    value  => true,
    notify => Exec['killall SystemUIServer'];
  }
  1. How to nameing manifest inter-class name (dock, keyboard, global...). I think that same as OS X's "System Preferences".

Thank you.

Recovery message cannot be updated

OS Version: OS X Yosemite (10.10.2)
puppet-osx Version: github "osx", "2.8.0"

Replication steps:

  • Include recovery_text similar to my manifest below
  • Run boxen
  • Observe an error.
  • Manually update the two values to match
  • Run boxen
  • Observe no errors.

Contents of ./modules/people/manifests/stephenyeargin.pp

  ##
  # OSX Defaults
  ##
  boxen::osx_defaults {
    "Set aqua color variant to graphite":
      ensure => present,
      key    => 'AppleAquaColorVariant',
      domain => 'NSGlobalDomain',
      user   => $::boxen_user,
      type   => 'int',
      value  => 6;
    "disables Dashboard":
      user   => $::boxen_user,
      domain => 'com.apple.dashboard',
      key    => 'mcx-disabled',
      value  => true;
  }
  ~> exec { 'killall Finder':
    refreshonly => true
  }
  class { 'osx::global::natural_mouse_scrolling':
    enabled => false
  }
  include osx::global::enable_keyboard_control_access
  include osx::no_network_dsstores
  include osx::dock::dim_hidden_apps
  class { 'osx::dock::icon_size':
    size => 72
  }
  osx::recovery_message { 'Call or text (615) 555-6380 if recovered.': }
}

192-168-0-108:~ (master) stephen$ boxen
--> Preparing to auto-update...
--> Complete! Nothing new from upstream.
Fact file /opt/boxen/repo/facts.d/example.yaml was parsed but returned an empty data set
Notice: Compiled catalog for 192-168-0-108.office.rv.cx in environment production in 6.00 seconds
Notice: /Stage[main]/People::Stephenyeargin/Osx::Recovery_message[Call or text (615) 555-6380 if recovered.]/Boxen::Osx_defaults[Set OS X Recovery Message]/Exec[osx_defaults write  /Library/Preferences/com.apple.loginwindow.plist:LoginwindowText=>Call or text (615) 555-6380 if recovered.]/returns: 2015-02-25 15:09:13.914 defaults[76740:2227763] Could not parse: Call or text (615) 555-6380 if recovered..  Try single-quoting it.
Error: /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow.plist LoginwindowText "Call or text (615) 555-6380 if recovered." returned 1 instead of one of [0]
Error: /Stage[main]/People::Stephenyeargin/Osx::Recovery_message[Call or text (615) 555-6380 if recovered.]/Boxen::Osx_defaults[Set OS X Recovery Message]/Exec[osx_defaults write  /Library/Preferences/com.apple.loginwindow.plist:LoginwindowText=>Call or text (615) 555-6380 if recovered.]/returns: change from notrun to 0 failed: /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow.plist LoginwindowText "Call or text (615) 555-6380 if recovered." returned 1 instead of one of [0]
Notice: /Stage[main]/People::Stephenyeargin/Osx::Recovery_message[Call or text (615) 555-6380 if recovered.]/Exec[Refresh CoreStorage EFI Cache]: Dependency Exec[osx_defaults write  /Library/Preferences/com.apple.loginwindow.plist:LoginwindowText=>Call or text (615) 555-6380 if recovered.] has failures: true
Warning: /Stage[main]/People::Stephenyeargin/Osx::Recovery_message[Call or text (615) 555-6380 if recovered.]/Exec[Refresh CoreStorage EFI Cache]: Skipping because of failed dependencies
Notice: /Stage[main]/People::Stephenyeargin/Osx::Recovery_message[Call or text (615) 555-6380 if recovered.]/Exec[Refresh system kext cache]: Dependency Exec[osx_defaults write  /Library/Preferences/com.apple.loginwindow.plist:LoginwindowText=>Call or text (615) 555-6380 if recovered.] has failures: true
Warning: /Stage[main]/People::Stephenyeargin/Osx::Recovery_message[Call or text (615) 555-6380 if recovered.]/Exec[Refresh system kext cache]: Skipping because of failed dependencies

Lock screen message is not set on 10.9

On 10.9, the recovery message shows up on the boot screen, but not the "locked" screen. You can set the lock screen message separately in the Security & Privacy control panel now, and changing it doesn't change the plist where the recovery message is set.

Fail when try to include any of preferences

Basically I am able install java, hipchat, sourcetree. And I can update file etc.
But when I tried to add:

https://github.com/boxen/puppet-osx

include osx::finder::unhide_library
include osx::finder::show_hidden_files

to my site.pp file, it is giving me:

Fact file /opt/boxen/repo/facts.d/example.yaml was parsed but returned an empty data set
Error: Could not find class osx::finder::unhide_library for mlimac1.roving.com on node mlimac1.roving.com
Error: Could not find class osx::finder::unhide_library for mlimac1.roving.com on node mlimac1.roving.com

I tried to not do this in site.pp rather than in my personal userName.pp file, I am getting the same thing.
From the Puppetfile, it seems that the puppetlabs-stdlib is fine and I didn't modify it.
github "stdlib", "4.2.1", :repo => "puppetlabs/puppetlabs-stdlib"

Please help. I am not sure what I did wrong here.

Some configs have no effect

include osx::global::tap_to_click
include osx::global::enable_standard_function_keys
include osx::keyboard::capslock_to_control

I clean installed OS X Mavericks. These three items have no effect.

Where can I see the values?

osx::dock::icon_size not in latest tag

Hi.

Just a heads up. Looks like the 'osx::dock::icon_size' stuff is in the docs but not in the latest tag so following the instructions in the README.md doesn't actually work if you've got the following in your Puppetfile:

github "osx",             "1.2.0"

Cheers.
Ben.

ArgumentError: Invalid resource type property_list_key

This didn't work for me until I added the following to my Puppetfile:

github "property_list_key", "0.1.0", :repo => "glarizza/puppet-property_list_key"

This may be obvious to some. But, it's probably worth noting in the README.md. Is there a way to automatically add dependencies?

Stoked on Boxen. Thanks for sharing the fruits of your labor!

key_repeat_delay doesn't work on Yosemite

Maybe I'm doing something wrong, but the following worked on Mavericks and has no effect on Yosemite:

class { 'osx::global::key_repeat_delay':
  delay => 30
}

The following does work from the command line:

$ defaults write NSGlobalDomain KeyRepeat -int 3

Librarian error when using puppet-osx

Added puppet-osx to my Puppetfile:

github "osx",         "1.2.0"

Running boxen generates an error:

@chingon ~> boxen
Boxen has a dirty tree, won't auto-update!
tar: Error opening archive: Failed to open 'osx'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1414:in `fu_each_src_dest0': undefined method `to_str' for nil:NilClass (NoMethodError)
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1400:in `fu_each_src_dest'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:423:in `cp_r'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/lib/librarian/puppet/source/githubtarball.rb:60:in `install_version!'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/lib/librarian/puppet/source/githubtarball.rb:208:in `install!'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/manifest.rb:89:in `install!'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/action/install.rb:49:in `install_manifests'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/action/install.rb:48:in `each'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/action/install.rb:48:in `install_manifests'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/action/install.rb:39:in `perform_installation'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/action/install.rb:12:in `run'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/cli.rb:157:in `install!'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/lib/librarian/puppet/cli.rb:64:in `install'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in `__send__'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/vendor/librarian/lib/librarian/cli.rb:29:in `bin!'
    from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.9/bin/librarian-puppet:9
    from /opt/boxen/repo/bin/librarian-puppet:16:in `load'
    from /opt/boxen/repo/bin/librarian-puppet:16
Can't run Puppet, fetching dependencies with librarian failed.

capslock_to_control not working on Yosemite

I've included osx::keyboard::capslock_to_control in my setup. I'm having problems getting it to work.

boxen::personal::includes:
  - osx::keyboard::capslock_to_control

This alters the settings like so:

> ioreg -n IOHIDKeyboard -r | grep -E 'VendorID"|ProductID' | \
awk ' { print $4 }' | paste -s -d'-\n' - | \
xargs -I{} sh -c 'defaults -currentHost read -g "com.apple.keyboard.modifiermapping.{}-0"'
(
        {
        HIDKeyboardModifierMappingDst = 2;
        HIDKeyboardModifierMappingSrc = 0;
    }
)

If I use the Keyboard preferences pane to remap left control to capslock, and capslock to control, I get the following changes in the defaults.

> ioreg -n IOHIDKeyboard -r | grep -E 'VendorID"|ProductID' | \
awk ' { print $4 }' | paste -s -d'-\n' - | \
xargs -I{} sh -c 'defaults -currentHost read -g "com.apple.keyboard.modifiermapping.{}-0"'
(
        {
        HIDKeyboardModifierMappingDst = 2;
        HIDKeyboardModifierMappingSrc = 0;
    },
        {
        HIDKeyboardModifierMappingDst = 0;
        HIDKeyboardModifierMappingSrc = 2;
    },
        {
        HIDKeyboardModifierMappingDst = 0;
        HIDKeyboardModifierMappingSrc = 10;
    }
)

If other people can confirm this looks good, I can try to alter the existing puppet class to reflect this.

Set background image

Useful for setting up Mac CI server.

Possible implementation:
osx::global::backgroud_color { "Solid Gray Light": } # See available strings at /Library/Desktop Pictures/Solid Colors/

Applescript

set desktopImage to POSIX file "/Library/Desktop Pictures/Solid Colors/Solid Gray Light.png"
tell application "Finder"
    set desktop picture to desktopImage
end tell

logout required -- how to avoid this??

Is there a way to not need a logout?? As with the task bar that gets reloaded to affect changes,, maybe there''s a reload here??

((apparently better touch tool and osx features are causing double keypresses for non alphanumeric keys too lol Something unrelated for me to figure out!! ))

add any option

for example my settings for mac looks like this, (there is tons of settings) all configured specially for me is there some possibility to set them all trough this module?

Setting :boxen_user

Many of the spec/classes/global files set boxen_user

For example, from expand_save_dialog_spec.rb:

let(:facts) { {:boxen_user => 'ilikebees'} }

Just trying to figure out why this is done. Do edits to global plist files require a dummy user?

Setting recovery message with nvram exec will fail if it contains an apostrophe

Note this line in the exec --> https://github.com/boxen/puppet-osx/blob/master/manifests/recovery_message.pp#L46

Because the value is wrapped in single-quotes, if you declare an osx::recovery_message resource that contains a single-quote/apostrophe in its title, the exec will fail. Removing the apostrophe fixes the exec failure.

I'm not sure of the solution here - maybe wrapping in double-quotes instead of single quotes (which displaces the issue to double-quotes), or possibly a function that searches for apostrophes and escapes them?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.