ansible-role-blockinfile icon indicating copy to clipboard operation
ansible-role-blockinfile copied to clipboard

Spacing in blocks does not work as expected

Open dobber opened this issue 8 years ago • 10 comments

- name: Add logstash-forwarder to datadog process monitoring
  blockinfile:
    dest: /etc/dd-agent/conf.d/process.yaml
    block: |
      - name: logstash-forwarder
        search_string: ['logstash-forwarder']
        exact_match: false
        thresholds:
          # critical if no server.py is running
          critical: [1, 1]

this code for example will be aligned to the first line in the block. this means that the result in the yaml would be:

- name: logstash-forwarder
  search_string: ['logstash-forwarder']

notice that spacing. the - name is at the beginning of the line and search_string is two spaces behind.

This breaks the yaml format and should be handled.

dobber avatar Sep 29 '15 20:09 dobber