You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Answer was provided - #3229 (comment) - but the answer is to set a default value for hosts, which I would never want to do.
Desired behavior is that we can set something in ansible-lint config to tell ansible-lint to ignore any undefined variables - either altogether, or specifically in the hosts: line
Actual Behavior
ansible-lint highlights error - The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'hosts_used' is undefined
This isn't an error - all my playbooks are designed to feed in a host as needed, on purpose. So, I should be able to tell Lint to ignore this error. Desired behavior is that we can set something in ansible-lint config to tell ansible-lint to ignore any undefined variables - either altogether, or specifically in the hosts: line
The text was updated successfully, but these errors were encountered:
Similarly, this issue does not go away even if the undefined part has a default and is a limiting filter:
hosts: "SOME_LOADBALANCERS:&{{ zone | default('SOME_ZONE') }}"
Side note: Yes I know you can do this with --limit but this is a variable that's guaranteed to be defined in our use-case, and having to define it in two variables or two places goes against consistent behaviour.
Summary
False positive for undefined variable in hosts.
Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
See issue #3229 - same question.
Desired Behavior
Answer was provided - #3229 (comment) - but the answer is to set a default value for
hosts
, which I would never want to do.Desired behavior is that we can set something in ansible-lint config to tell ansible-lint to ignore any undefined variables - either altogether, or specifically in the
hosts:
lineActual Behavior
ansible-lint highlights error -
The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'hosts_used' is undefined
This isn't an error - all my playbooks are designed to feed in a host as needed, on purpose. So, I should be able to tell Lint to ignore this error. Desired behavior is that we can set something in ansible-lint config to tell ansible-lint to ignore any undefined variables - either altogether, or specifically in the
hosts:
lineThe text was updated successfully, but these errors were encountered: