Ansible: How to add variables to "command" or "shell"
The syntax error is because you started a value with {
. If you begin a value with a variable like so:
command: {{ my_var }}
then you must quote the whole line:
command: "{{ my_var }}"
This is due to the parser not being able to distinguish between YAML's dictionary syntax and variable interpolation otherwise.
Quote the full string in the command
argument:
- name: Iniciar zkfc
command: "{{ hadoop_version }}/sbin/hadoop-daemon.sh start zkfc"