# Help removing block in file please.

**URL:** <https://forum.ansible.com/t/help-removing-block-in-file-please/22629>\
**Category:** Ansible Project\
**Created:** [September 23, 2016, 5:13pm UTC](https://forum.ansible.com/t/help-removing-block-in-file-please/22629 "2016-09-23T17:13:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [September 23, 2016, 5:13pm UTC](https://forum.ansible.com/t/help-removing-block-in-file-please/22629/1 "2016-09-23T17:13:44Z")

</div>

I have a file with the following bock of text in it. I have text before and after the text block.

`logstash: hash: $fj;kdjjfajf;ajKFJ;dfj;dkfja;dfjFJ:LFJj;kj;lfkajs #password is: some_pw`

I’m trying to remove the block using this code:

`

- name: Delete existing logstash user  
blockinfile:  
dest: /path\_to\_file/foo.yml  
state: absent  
block: |  
logstash:  
hash: $fj;kdjjfajf;ajKFJ;dfj;dkfja;dfjFJ:LFJj;kj;lfkajs  
#password is: some\_pw  
`

But the block persists. What am i missing? Thanks.

---

<div class="post-metadata">

**Author:** ![Tom\_Paine1](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@Tom\_Paine1](https://forum.ansible.com/u/Tom_Paine1)\
**Post date:** [November 15, 2016, 11:38am UTC](https://forum.ansible.com/t/help-removing-block-in-file-please/22629/2 "2016-11-15T11:38:43Z")

</div>

Did you ever figure this out?
