Greetings,
The documentation always uses the following syntax style when talking about
or giving examples of module usage:
- name: Set up /tmp/timings file
lineinfile: >
dest=/tmp/timings line="{{ ansible_local.preferences.launch_msg }}"
create=yes
I've had issues in the past when I had a long list of arguments, a
loop/templating, and the need to YAML escape a character or two. I ended
up with quotes around the entire argument block and had difficulty getting
the escape to work, the templating to work, and have the whole scalar
parsable by Ansible. Then I found that the following syntax works:
- name: Set up /tmp/timings file
lineinfile:
dest: /tmp/timings
line: "{{ ansible_local.preferences.launch_msg }}"
create: yes
Which just makes a ton more sense. Easier to write and read. Got to be
easier to parse.
Is there a reason the latter isn't the suggested/recommended syntax?
Jack Neely
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/0d737fbc-50b5-45a1-b6d8-d6ffc3c21a43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.