blockinfile keeps adding the block
<p>I'd like to add a block of text to my ElasticSearch configuration using blockinfile, but every time I run my playbook, the block gets added to the file -- even when it already exists.  This is a problem because ElasticSearch doesn't just take the last value, it chokes on startup saying "you have multiple entries for this value" (or something similar).</p>

<p>My play looks like this:</p>

<pre><code>  - name: configure elasticsearch
    blockinfile:
      dest: /etc/elasticsearch/elasticsearch.yml
      marker: "## added by ansible configuration"
      block: |
        network.host: 0.0.0.0
        path.data: /var/lib
        path.logs: /var/log/elasticsearch
        path.repo: /home/chris/elastic-backups
      state: present
</code></pre>

<p>But after running my playbook a second time, my <code>elasticsearch.yml</code> file looks like:</p>

<pre><code>## added by ansible configuration
network.host: 0.0.0.0
path.data: /var/lib
path.logs: /var/log/elasticsearch
path.repo: /home/chris/elastic-backups
## added by ansible configuration
network.host: 0.0.0.0
path.data: /var/lib
path.logs: /var/log/elasticsearch
path.repo: /home/chris/elastic-backups
## added by ansible configuration
</code></pre>

<p>Is there a way to only add the block if it does not exist yet?</p>