|
|
@ -37,6 +37,11 @@ options:
|
|
|
|
- name of package to install/remove
|
|
|
|
- name of package to install/remove
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: None
|
|
|
|
default: None
|
|
|
|
|
|
|
|
path:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- ':' separated list of paths to search for 'brew' executable. Since A package (I(formula) in homebrew parlance) location is prefixed relative to the actual path of I(brew) command, providing an alternative I(brew) path enables managing different set of packages in an alternative location in the system.
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: '/usr/local/bin'
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- state of the package
|
|
|
|
- state of the package
|
|
|
@ -64,10 +69,22 @@ options:
|
|
|
|
notes: []
|
|
|
|
notes: []
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|
|
|
|
|
# Install formula foo with 'brew' in default path (C(/usr/local/bin))
|
|
|
|
- homebrew: name=foo state=present
|
|
|
|
- homebrew: name=foo state=present
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Install formula foo with 'brew' in alternate path C(/my/other/location/bin)
|
|
|
|
|
|
|
|
- homebrew: name=foo path=/my/other/location/bin state=present
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Update homebrew first and install formula foo with 'brew' in default path
|
|
|
|
- homebrew: name=foo state=present update_homebrew=yes
|
|
|
|
- homebrew: name=foo state=present update_homebrew=yes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Update homebrew first and upgrade formula foo to latest available with 'brew' in default path
|
|
|
|
- homebrew: name=foo state=latest update_homebrew=yes
|
|
|
|
- homebrew: name=foo state=latest update_homebrew=yes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Update homebrew and upgrade all packages
|
|
|
|
- homebrew: update_homebrew=yes upgrade_all=yes
|
|
|
|
- homebrew: update_homebrew=yes upgrade_all=yes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Miscellaneous other examples
|
|
|
|
- homebrew: name=foo state=head
|
|
|
|
- homebrew: name=foo state=head
|
|
|
|
- homebrew: name=foo state=linked
|
|
|
|
- homebrew: name=foo state=linked
|
|
|
|
- homebrew: name=foo state=absent
|
|
|
|
- homebrew: name=foo state=absent
|
|
|
@ -303,7 +320,7 @@ class Homebrew(object):
|
|
|
|
return package
|
|
|
|
return package
|
|
|
|
# /class properties -------------------------------------------- }}}
|
|
|
|
# /class properties -------------------------------------------- }}}
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, module, path=None, packages=None, state=None,
|
|
|
|
def __init__(self, module, path, packages=None, state=None,
|
|
|
|
update_homebrew=False, upgrade_all=False,
|
|
|
|
update_homebrew=False, upgrade_all=False,
|
|
|
|
install_options=None):
|
|
|
|
install_options=None):
|
|
|
|
if not install_options:
|
|
|
|
if not install_options:
|
|
|
@ -329,13 +346,8 @@ class Homebrew(object):
|
|
|
|
setattr(self, key, val)
|
|
|
|
setattr(self, key, val)
|
|
|
|
|
|
|
|
|
|
|
|
def _prep(self):
|
|
|
|
def _prep(self):
|
|
|
|
self._prep_path()
|
|
|
|
|
|
|
|
self._prep_brew_path()
|
|
|
|
self._prep_brew_path()
|
|
|
|
|
|
|
|
|
|
|
|
def _prep_path(self):
|
|
|
|
|
|
|
|
if not self.path:
|
|
|
|
|
|
|
|
self.path = ['/usr/local/bin']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _prep_brew_path(self):
|
|
|
|
def _prep_brew_path(self):
|
|
|
|
if not self.module:
|
|
|
|
if not self.module:
|
|
|
|
self.brew_path = None
|
|
|
|
self.brew_path = None
|
|
|
@ -770,7 +782,10 @@ def main():
|
|
|
|
required=False,
|
|
|
|
required=False,
|
|
|
|
type='list',
|
|
|
|
type='list',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
path=dict(required=False),
|
|
|
|
path=dict(
|
|
|
|
|
|
|
|
default="/usr/local/bin",
|
|
|
|
|
|
|
|
required=False,
|
|
|
|
|
|
|
|
),
|
|
|
|
state=dict(
|
|
|
|
state=dict(
|
|
|
|
default="present",
|
|
|
|
default="present",
|
|
|
|
choices=[
|
|
|
|
choices=[
|
|
|
@ -808,8 +823,6 @@ def main():
|
|
|
|
path = p['path']
|
|
|
|
path = p['path']
|
|
|
|
if path:
|
|
|
|
if path:
|
|
|
|
path = path.split(':')
|
|
|
|
path = path.split(':')
|
|
|
|
else:
|
|
|
|
|
|
|
|
path = ['/usr/local/bin']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state = p['state']
|
|
|
|
state = p['state']
|
|
|
|
if state in ('present', 'installed'):
|
|
|
|
if state in ('present', 'installed'):
|
|
|
|