diff --git a/changelogs/fragments/56650-homebrew-update_brew.yml b/changelogs/fragments/56650-homebrew-update_brew.yml new file mode 100644 index 0000000000..01b73b937d --- /dev/null +++ b/changelogs/fragments/56650-homebrew-update_brew.yml @@ -0,0 +1,2 @@ +minor_changes: +- homebrew - Added environment variable to honor update_homebrew setting (https://github.com/ansible/ansible/issues/56650). diff --git a/plugins/modules/packaging/os/homebrew.py b/plugins/modules/packaging/os/homebrew.py index 20fe159397..dbaa2b1e74 100644 --- a/plugins/modules/packaging/os/homebrew.py +++ b/plugins/modules/packaging/os/homebrew.py @@ -941,6 +941,10 @@ def main(): state = 'absent' update_homebrew = p['update_homebrew'] + if not update_homebrew: + module.run_command_environ_update.update( + dict(HOMEBREW_NO_AUTO_UPDATE="True") + ) upgrade_all = p['upgrade_all'] p['install_options'] = p['install_options'] or [] install_options = ['--{0}'.format(install_option) diff --git a/tests/integration/targets/homebrew/tasks/main.yml b/tests/integration/targets/homebrew/tasks/main.yml index 0db5096138..f9b5eacc61 100644 --- a/tests/integration/targets/homebrew/tasks/main.yml +++ b/tests/integration/targets/homebrew/tasks/main.yml @@ -35,8 +35,6 @@ become: yes become_user: "{{ brew_stat.stat.pw_name }}" register: xz_result - environment: - HOMEBREW_NO_AUTO_UPDATE: True - assert: that: @@ -50,8 +48,6 @@ become: yes become_user: "{{ brew_stat.stat.pw_name }}" register: xz_result - environment: - HOMEBREW_NO_AUTO_UPDATE: True - assert: that: @@ -65,8 +61,6 @@ become: yes become_user: "{{ brew_stat.stat.pw_name }}" register: xz_result - environment: - HOMEBREW_NO_AUTO_UPDATE: True - assert: that: @@ -80,8 +74,6 @@ become: yes become_user: "{{ brew_stat.stat.pw_name }}" register: xz_result - environment: - HOMEBREW_NO_AUTO_UPDATE: True - assert: that: