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
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 can use a block indentation indicator http://www.yaml.org/spec/1.2/spec.html#id2793979
e.g:
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
Thanks!
This seems to be broken in Ansible 2.1.1.0.
Block indentation indicator still broken in ansible 2.3
Raised a new issue #23777 YAML block indentation indicator not working in Ansible 2.3.0.0.
Jonathan