We've used tab-characters in some of YAML-files here:
host: "foo"
port: 8011
p: "bar"
For some reason, the same version of Ansible running the same playbook works just fine with these files for some users, but complains about "invalid characters" for others:
ERROR! Syntax Error while loading YAML.
found character '\t' that cannot start any token
The error appears to have been in '.../playbooks/roles/native-package/defaults/main.yml': line 1, column
8, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
tmpdir: >-
^ here
There appears to be a tab character at the start of the line.
YAML does not use tabs for formatting. Tabs should be replaced with spaces.
For example:
- name: update tooling
vars:
version: 1.2.3
# ^--- there is a tab there.
Should be written as:
- name: update tooling
vars:
version: 1.2.3
# ^--- all spaces here.
I'm not asking, whether tabs are "better" than spaces -- but I'd like to understand the inconsistency...
pyyaml
for parsing, which will use libYAML if it's present, but includes it's own fallback parser that gets used if the system doesn't have libYAML. It sounds like either libYAML or the pyyaml fallback parser has an issue with tabs.