diff --git a/changelogs/fragments/6267-homebrew-cask-upgrade-all-greedy.yml b/changelogs/fragments/6267-homebrew-cask-upgrade-all-greedy.yml new file mode 100644 index 0000000000..c470cf3a7c --- /dev/null +++ b/changelogs/fragments/6267-homebrew-cask-upgrade-all-greedy.yml @@ -0,0 +1,2 @@ +minor_changes: + - homebrew_cask - allows passing ``--greedy`` option to ``upgrade_all`` (https://github.com/ansible-collections/community.general/pull/6267). diff --git a/plugins/modules/homebrew_cask.py b/plugins/modules/homebrew_cask.py index 162c184612..c992693b68 100644 --- a/plugins/modules/homebrew_cask.py +++ b/plugins/modules/homebrew_cask.py @@ -78,8 +78,9 @@ options: greedy: description: - Upgrade casks that auto update. - - Passes --greedy to brew cask outdated when checking - if an installed cask has a newer version available. + - Passes C(--greedy) to C(brew outdated --cask) when checking + if an installed cask has a newer version available, + or to C(brew upgrade --cask) when upgrading all casks. type: bool default: false ''' @@ -128,6 +129,11 @@ EXAMPLES = ''' community.general.homebrew_cask: upgrade_all: true +- name: Upgrade all casks with greedy option + community.general.homebrew_cask: + upgrade_all: true + greedy: true + - name: Upgrade given cask with force option community.general.homebrew_cask: name: alfred @@ -581,6 +587,9 @@ class HomebrewCask(object): else: cmd = [self.brew_path, 'cask', 'upgrade'] + if self.greedy: + cmd = cmd + ['--greedy'] + rc, out, err = '', '', '' if self.sudo_password: