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
Hello,
can you please explain to me, why you are forcing the playbook check to use localhost as inventory?
With this MR you introduces the -i localhost to the playbooks checks and as it is parsed as an cli argument there is no way to overwrite it. Before it was possible to set the ANSIBLE_INVENTORY env.
I tried adding the default values but as it is trying to parse the groups var it fails. To get it working I have to create an if else: {% if 'kube_masters' in groups%}{{ (groups['kube_masters'] | random)}}{% else %}kube_masters{% endif %} which IMO is unneeded/ unwanted.
syntax-check: The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'dict object' has no attribute 'kube_masters'
play_kube-cluster-setup.yml:13:3 [WARNING]: Could not match supplied host pattern, ignoring: k8s
[WARNING]: Could not match supplied host pattern, ignoring: kube_masters
[WARNING]: Could not match supplied host pattern, ignoring: kube_workers
ERROR! The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'dict object' has no attribute 'kube_masters'
The error appears to be in '/builds/dev-ops/ansible/play_kube-cluster-setup.yml': line 13, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- hosts: "{{ (groups['kube_masters'] | random) | default('kube_masters') }}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
Finished with 1 failure(s), 0 warning(s) on 64 files.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
can you please explain to me, why you are forcing the playbook check to use localhost as inventory?
With this MR you introduces the
-i localhost
to the playbooks checks and as it is parsed as an cli argument there is no way to overwrite it. Before it was possible to set theANSIBLE_INVENTORY
env.I tried adding the default values but as it is trying to parse the groups var it fails. To get it working I have to create an if else:
{% if 'kube_masters' in groups%}{{ (groups['kube_masters'] | random)}}{% else %}kube_masters{% endif %}
which IMO is unneeded/ unwanted.Beta Was this translation helpful? Give feedback.
All reactions