Version information
This version is compatible with:
- Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 3.0.0 < 5.0.0
- Darwin
Start using this module
Add this module to your Puppetfile:
mod 'thekevjames-homebrew', '1.7.0'
Learn more about managing modules with a PuppetfileDocumentation
puppet-homebrew
A Puppet Module to install Homebrew and manage Homebrew packages on Mac OSX. This module can install using either homebrew or brewcask, along with a fallback mode which attempts both.
This module supports Puppet version 3 and greater running on Ruby version 1.8.3 and greater.
puppet-homebrew is available on the Puppet Forge.
Usage
Installing packages
Use the Homebrew package provider like this:
class hightower::packages {
pkglist = ['postgresql', 'nginx', 'git', 'tmux']
package { $pkglist:
ensure => present,
provider => brew,
}
}
The providers works as follows:
provider => brew
: install usingbrew install <module>
. Do not use brewcask.provider => brewcask
: install usingbrew cask install <module>
. Only use brewcask.provider => homebrew
: attempt to install usingbrew install <module>
. On failure, usebrew cask install <module>
Tapping repositories
To tap into new Github repositories, simply use the tap provider:
package { 'neovim/neovim':
ensure => present,
provider => tap,
}
You can untap a repository by setting ensure to absent
.
Ordering taps
When both tapping a repo and installing a package from that repository, it is important to make sure the former happens first. This can be accomplished in a few different ways: either by doing so on a per-package basis:
package { 'neovim/neovim':
ensure => present,
provider => tap,
} ->
package { 'neovim':
ensure => present,
provider => homebrew,
}
or by setting all taps to occur before all other usages of this package with Resource Collectors:
# pick whichever provider(s) are relevant
Package <| provider == tap |> -> Package <| provider == homebrew |>
Package <| provider == tap |> -> Package <| provider == brew |>
Package <| provider == tap |> -> Package <| provider == brewcask |>
Installing brew
To install homebrew on a node (with a compiler already present!):
class { 'homebrew':
user => 'hightower',
group => 'developers', # defaults to 'admin'
}
Installing homebrew as the root user is no longer supported (as of late 2016). Please ensure you install brew as a standard (non-root) user.
Note that some users have reported confusion between the puppet user and the homebrew user -- it is perfectly fine to run puppet as root, in fact this is encouraged, but the homebrew user must be non-root (generally, the system's main user account).
If you run puppet as a non-root user and set the homebrew::user
to a
different non-root user, you may run into issues; namely, since this module
requires the puppet user act as the homebrew user, you may get a password
prompt on each run. This can be fixed by allowing the puppet user passwordless
sudo privileges to the homebrew user.
To install homebrew and a compiler (on Lion or later), eg.:
class { 'homebrew':
user => 'kevin',
command_line_tools_package => 'command_line_tools_for_xcode_os_x_lion_april_2013.dmg',
command_line_tools_source => 'http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_lion_april_2013.dmg',
}
N.B. the author of this module does not maintain a mirror to command_line_tools. You may need to search for a copy if you use this method. At the time of this writing, downloading the command line tools sometimes requires an Apple ID. Sorry, dude!
Adding a Github Token
Homebrew uses a Github token in your environment to make your experience better by:
- Reducing the rate limit on
brew search
commands - Letting you tap your private repositories
- Allowing you to upload Gists of brew installation errors
To enable this feature, you can include:
class { 'homebrew':
user => 'kevin',
github_token => 'MyT0k3n!',
}
Click here to create a personal access token for Github.
Original Author
Original credit for this module goes to kelseyhightower. This module was forked to provide brewcask integration.
Credit for logic involved in tapping repositories goes to gildas.
CHANGELOG
1.7.0
- feature: allow usage within non-brew and bundler environments
- feature: support ruby 1.8.3 installations
- meta: more and better linting
1.6.0
- feature: permission management more closely aligns to brew install
- bugfix: ensure providers load regardless of configured puppet load order
- bugfix: ensure facts work on all puppet versions
- bugfix: ensure packages with 'homebrew-' prefix are not re-installed
- bugfix: do not allow homebrew root install
1.5.0
- feature: allow package to set HOMEBREW_GITHUB_API_TOKEN
- feature/bugfix: stop parsing homebrew output, parse response codes instead
- bugfix: manage /usr/local/Homebrew rather than parent directory
- meta: speed up tests
1.4.3
- bugfix: manage objects (packages, taps, etc) case-insensitively
- meta: deprecate root-owned homebrew
- meta: clean up tests
1.4.2
- bugfix: fixed bug where brew-cask provider didn't work the first time
- meta: updated to new homebrew install location
1.4.1
- feature: allow usage by any member of homebrew group
1.4.0
- feature: remove files with invalid checksums for easier retrying
- bugfix: ensure
install_options
propgates correctly - bugfix: detect and fail properly on checksum errors
- meta: include README section on ordering taps/packages
1.3.3
- feature: allow user/group override
- bugfix: remove
err
from facter code
1.3.2
- bugfix: fix compat issues for facter booleans
- bugfix: use puppet warning over ruby warn
1.3.1
- bugfix: only download CLI tools if values are set
- meta: move away from params class
1.3.0
- feature: allow users to manage taps
- meta: better testing, OSX-specific tests on Travis
- meta: fix typos, add contributer list
1.2.0
- bugfix: set directory permissions to brew defaults
- bugfix: fix brewcask parsing
- meta: enable auto-testing
1.1.1
- bugfix: ensure brew is called with correct user
1.1.0
- feature: add install_options
- feature: add upgradeable
- tech debt: clean up inheritance pattern
1.0.1
- documentation fixes
1.0.0
- initial release
Dependencies
- puppetlabs/stdlib (>= 4.2.0 < 5.0.0)