Comments (4)
IIRC, Ansible 2.0+ dislikes undefined variables, which seems to obviate the is defined
check. My guess is the "best" (or at least easiest) fix is to uncomment the offending variable in defaults/main.yml
, thus defining it. Sane default; easily overridden.
from ansible-role-homebrew.
There's another way of defining that when
condition, though... I can't recall right now and can't look up in my recent commits to other roles, but you basically have to do two checks to see if it's defined and has a valueโI think. It might be safer/more sane, otherwise I'm okay with just uncommenting that default var if it doesn't cause any other issues.
from ansible-role-homebrew.
Thanks for the quick responses and feedback.
I've determined the root cause of the failed task; the with_items: {{ homebrew_uninstalled_packages }}
is evaluated before the when: homebrew_uninstalled_packages is defined
clause. This is intended behavior (See ansible/ansible#13950), and one solution is to change it to with_items: {{ homebrew_uninstalled_packages|default([]) }}
.
However, IMO the better solution is to uncomment the line in defaults/main.yml
and remove the when
clause from the task altogether, for the following reasons:
- From the POV of someone new using this role, it's nice to be able to just look in the
defaults/main.yml
to see all available variables and defaults, especially when every other variable is defined and defaulted in this file. Similarly, the README remains consistent and unchanged; it currently mistakenly suggests that thehomebrew_uninstalled_packages
is defaulted to[]
like the other documented variables. - The task usage of
homebrew_uninstalled_packages
variable would become consistent and semantically the same as the task for installing packages viahomebrew_installed_packages
. I don't see a good reason why this task needs to be different, but please enlighten me if there's a use case I can't see.
I've submitted PR #67 with my proposed fix.
Thank you for your time.
from ansible-role-homebrew.
Fixed in above PR!
from ansible-role-homebrew.
Related Issues (20)
- `Force update brew after installation.` task fails if `homebrew_user` is different than `ansible_user_id` HOT 1
- error trying to install cask HOT 1
- Update Homebrew Itself HOT 2
- Question: Can you please explain why we are not using the official install shell script? HOT 2
- Speedup brew and brew cask install/uninstall tasks HOT 2
- Install from Brewfile fails when mas Apps are included HOT 2
- Installing casks requiring sudo password? HOT 6
- When installing casks, anything with a dash errors. HOT 15
- Migrate from Travis CI to GitHub Actions for testing HOT 2
- Preparing for Ansible 2.10 Collections HOT 2
- `brew cask install` is deprecated in favour of `brew install --cask` HOT 6
- Error: Cannot install in Homebrew on ARM processor in Intel default prefix HOT 1
- homebrew_tap module fails when moving the homebrew_prefix and brew is not in the path HOT 3
- dot files repo only supports "master" branch HOT 1
- Running against macos 10.14.6 fails HOT 1
- installing is very slow. HOT 1
- Hanging at Ensure Homebrew parent directory has correct permissions HOT 1
- Install from Brewfile unable to find brew HOT 1
- execute local vs ssh HOT 1
- Deprecate this role in favor of the new geerlingguy.mac collection HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-role-homebrew.