You can use a block indentation
indicator http://www.yaml.org/spec/1.2/spec.html#id2793979
e.g:
- blockinfile:
dest: /etc/postfix/master.cf
insertafter: "^submission inet n - n - -
smtpd$"
block: |2
-o syslog_name=postfix/submission
-o ...
The number specifies how many spaces there are that are meaningful, so
there's a total of 8 leading spaces, 6 of which are yaml indentation and 2
for the block itself.
>From this excellent answer: http://stackoverflow.com/a/21699210
On Friday, 27 May 2016 08:33:15 UTC+12, Joanna Delaporte wrote:
>
> I am using blockinfile to write lines to a vars file that includes a few
> different layers of indentation. How do I make sure the indentation levels
> are maintained correctly using the block | statement?
>
> Thanks!
> Joanna
>
--
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/0f5cf440-2a61-4db4-9259-fa98d63ff883%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.