@ -1,8 +1,8 @@
#!/usr/bin/python
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# Copyright: (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# (c) 2016, Indrajit Raychaudhuri <irc+code@indrajit.com>
# Copyright: (c) 2016, Indrajit Raychaudhuri <irc+code@indrajit.com>
#
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
@ -10,131 +10,143 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
__metaclass__ = type
ANSIBLE_METADATA = { ' metadata_version ' : ' 1.1 ' ,
ANSIBLE_METADATA = {
' status ' : [ ' preview ' ] ,
' metadata_version ' : ' 1.1 ' ,
' supported_by ' : ' community ' }
' status ' : [ ' preview ' ] ,
' supported_by ' : ' community '
}
DOCUMENTATION = '''
DOCUMENTATION = '''
- - -
- - -
module : homebrew_cask
module : homebrew_cask
author :
author :
- " Indrajit Raychaudhuri (@indrajitr) "
- " Indrajit Raychaudhuri (@indrajitr) "
- " Daniel Jaouen (@danieljaouen) "
- " Daniel Jaouen (@danieljaouen) "
- " Enric Lluelles (@enriclluelles) "
- " Enric Lluelles (@enriclluelles) "
requirements :
requirements :
- " python >= 2.6 "
- " python >= 2.6 "
short_description : Install / uninstall homebrew casks .
short_description : Install and uninstall homebrew casks .
description :
description :
- Manages Homebrew casks .
- Manages Homebrew casks .
version_added : " 1.6 "
version_added : " 1.6 "
options :
options :
name :
name :
description :
description :
- name of cask to install / remove
- Name of cask to install or remove .
required : true
required : true
aliases : [ ' pkg ' , ' package ' , ' cask ' ]
aliases : [ ' pkg ' , ' package ' , ' cask ' ]
path :
type : list
description :
path :
- " ' : ' separated list of paths to search for ' brew ' executable. "
description :
default : ' /usr/local/bin '
- " ' : ' separated list of paths to search for ' brew ' executable. "
state :
default : ' /usr/local/bin '
description :
type : path
- state of the cask
state :
choices : [ ' present ' , ' absent ' , ' upgraded ' ]
description :
default : present
- State of the cask .
sudo_password :
choices : [ ' present ' , ' absent ' , ' upgraded ' ]
description :
default : present
- The sudo password to be passed to SUDO_ASKPASS .
type : str
required : false
sudo_password :
version_added : 2.8
description :
update_homebrew :
- The sudo password to be passed to SUDO_ASKPASS .
description :
required : false
- update homebrew itself first . Note that C ( brew cask update ) is
version_added : 2.8
a synonym for C ( brew update ) .
type : str
type : bool
update_homebrew :
default : ' no '
description :
aliases : [ ' update-brew ' ]
- Update homebrew itself first .
version_added : " 2.2 "
- Note that C ( brew cask update ) is a synonym for C ( brew update ) .
install_options :
type : bool
description :
default : ' no '
- options flags to install a package
aliases : [ ' update-brew ' ]
aliases : [ ' options ' ]
version_added : " 2.2 "
version_added : " 2.2 "
install_options :
accept_external_apps :
description :
description :
- Options flags to install a package .
- allow external apps
aliases : [ ' options ' ]
type : bool
version_added : " 2.2 "
default : ' no '
type : list
version_added : " 2.5.0 "
accept_external_apps :
upgrade_all :
description :
description :
- Allow external apps .
- upgrade all casks ( mutually exclusive with ` upgrade ` )
type : bool
type : bool
default : ' no '
default : ' no '
version_added : " 2.5.0 "
version_added : " 2.5.0 "
upgrade_all :
upgrade :
description :
description :
- Upgrade all casks .
- upgrade all casks ( mutually exclusive with ` upgrade_all ` )
- Mutually exclusive with C ( upgraded ) state .
type : bool
type : bool
default : ' no '
default : ' no '
version_added : " 2.5.0 "
version_added : " 2.5.0 "
greedy :
aliases : [ ' upgrade ' ]
description :
greedy :
- upgrade casks that auto update ; passes - - greedy to brew cask
description :
outdated when checking if an installed cask has a newer version
- Upgrade casks that auto update .
available
- Passes - - greedy to brew cask outdated when checking
type : bool
if an installed cask has a newer version available .
default : ' no '
type : bool
version_added : " 2.7.0 "
default : ' no '
version_added : " 2.7.0 "
'''
'''
EXAMPLES = '''
EXAMPLES = '''
- homebrew_cask :
- name : Install cask
homebrew_cask :
name : alfred
name : alfred
state : present
state : present
- homebrew_cask :
- name : Remove cask
homebrew_cask :
name : alfred
name : alfred
state : absent
state : absent
- homebrew_cask :
- name : Install cask with install options
homebrew_cask :
name : alfred
name : alfred
state : present
state : present
install_options : ' appdir=/Applications '
install_options : ' appdir=/Applications '
- homebrew_cask :
- name : Install cask with install options
homebrew_cask :
name : alfred
name : alfred
state : present
state : present
install_options : ' debug,appdir=/Applications '
install_options : ' debug,appdir=/Applications '
- homebrew_cask :
- name : Allow external app
homebrew_cask :
name : alfred
name : alfred
state : present
state : present
accept_external_apps : True
accept_external_apps : True
- homebrew_cask :
- name : Remove cask with force option
homebrew_cask :
name : alfred
name : alfred
state : absent
state : absent
install_options : force
install_options : force
- homebrew_cask :
- name : Upgrade all casks
homebrew_cask :
upgrade_all : true
upgrade_all : true
- homebrew_cask :
- name : Upgrade given cask with force option
homebrew_cask :
name : alfred
name : alfred
state : upgraded
state : upgraded
install_options : force
install_options : force
- homebrew_cask :
- name : Upgrade cask with greedy option
homebrew_cask :
name : 1 password
name : 1 password
state : upgraded
state : upgraded
greedy : True
greedy : True
- homebrew_cask :
- name : Using sudo password for installing cask
homebrew_cask :
name : wireshark
name : wireshark
state : present
state : present
sudo_password : " {{ ansible_become_pass }} "
sudo_password : " {{ ansible_become_pass }} "
'''
'''
import os
import os