Created
October 14, 2013 20:46
-
-
Save darKoram/6981909 to your computer and use it in GitHub Desktop.
Demonstrate the unsuitable YAML syntax error when there is a space before "---" leading a vars/main.yml file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# note the space before the --- | |
var1: "val" | |
# PRODUCES ERROR MESSAGE | |
# ansible-playbook -i hosts playbooks/test2.yml --limit=localhost | |
# [' var1', ' "val"'] | |
# ERROR: Syntax Error while loading YAML script, /Users/kbroughton/vcp/git/21ct/proto/lynx-ansible/vars/main.yml | |
# Note: The error may actually appear before this position: line 3, column 6 | |
# var1: "val" | |
# ^ | |
# We could be wrong, but this one looks like it might be an issue with | |
# unbalanced quotes. If starting a value with a quote, make sure the | |
# line ends with the same set of quotes. For instance this arbitrary | |
# example: | |
# foo: "bad" "wolf" | |
# Could be written as: | |
# foo: '"bad" "wolf"' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts | |
vars_files: | |
- main.yml | |
tasks: | |
# call a variable in main.yml | |
- debug: msg="{{var1}}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
assuming a suitable hosts file, running the following command reproduces the error.
$ ansible-playbook -i hosts playbook_demo.yml --limit=localhost