ansible and yaml syntax - There appears to be both 'k=v' shorthand syntax and YAML in this task. Only one syntax may be used.

Hello,

any clues what is a workaround for the syntax issue below? This variable is defined in a group among other variables. My playbook won’t run because of this error. I may have to escape the =… I m hoping to keep the string as human friendly as possible though. I am using quote so I can replace the password with a shared password variable.

here is the variable definition:

db_connectionstring: “User ID=myuser;Initial Catalog=mycatalog;Data Source=db\instance;persist security info=True;password=mypass;Pooling=True”

The error

2020-02-25T14:01:13.6121920Z ##[error]ERROR! Syntax Error while loading YAML.
2020-02-25T14:01:13.6122859Z did not find expected key
2020-02-25T14:01:13.6123034Z
2020-02-25T14:01:13.6123401Z The error appears to be in ‘/var/lib/rundeck/ansible/inventories/vin_qa01/group_vars/all/vars.yml’: line 66, column 42, but may
2020-02-25T14:01:13.6123829Z be elsewhere in the file depending on the exact syntax problem.
2020-02-25T14:01:13.6124028Z
2020-02-25T14:01:13.6124275Z The offending line appears to be:
2020-02-25T14:01:13.6124480Z
2020-02-25T14:01:13.6124871Z db_connectionstring_contentuser: “User ID=myuser;Initial Catalog=mycatalog;Data Source=db\instance;persist security info=True;password=mypass;Pooling=True”
2020-02-25T14:01:13.6125323Z ^ here
2020-02-25T14:01:13.6125516Z
2020-02-25T14:01:13.6125847Z There appears to be both ‘k=v’ shorthand syntax and YAML in this task. Only one syntax may be used.
2020-02-25T14:01:13.6126232Z This one looks easy to fix. It seems that there is a value started
2020-02-25T14:01:13.6126600Z with a quote, and the YAML parser is expecting to see the line ended
2020-02-25T14:01:13.6126925Z with the same kind of quote. For instance:
2020-02-25T14:01:13.6127100Z
2020-02-25T14:01:13.6127359Z when: “ok” in result.stdout

any guidance vm appreciated!
-nic

There is nothing wrong with that variable.
As the error says, it may be elsewhere in the file depending on the
exact syntax problem.
In fact, it might not even be in
/var/lib/rundeck/ansible/inventories/vin_qa01/group_vars/all/vars.yml
(which you didn't post).
A clue is found here: 'There appears to be both 'k=v' shorthand syntax
and YAML in this task."
Tasks sit in a playbook - which you also didn't post.

There is nothing else to do with the information you provided.

It's not clear why and what key is YAML expecting. A review of complete
'group_vars/all/vars.yml' will be needed.

  -vlado

Thanks for confirming the syntax looks ok.