I'm using Ansible 2.0.1.0.
In my main.yml
I have this task:
- name: hoge
hosts: hoge2
connection: docker
become: yes
become_user: {{ansible_user}}
When executing, I get this error message:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/Users/fuga/Docker/ansible/main.yml': line 16, column 17, but maybe elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
become: yes
become_user: {{ansible_user}}
^ here
How can I fix the error?
In YAML a
{
starts a dictionary. Therefore you need to quote the expression.See Gotchas in the Ansible YAML docs.