Help removing block in file please.

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.

Did you ever figure this out?