blockinfile is the right choice
anyway I'm not sure if the argument block is necessary
fusillator@catorcio:~/Code/ansible/test$ cat blockinfile.yml
- hosts: localhost
fusillator@catorcio:~/Code/ansible/test$ ansible-playbook blockinfile.yml
PLAY [localhost] **************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [remove block regexps] ***************************************************************************************************************************************************************************************************************************************************
changed: [localhost]
PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
fusillator@catorcio:~/Code/ansible/test$ cat resolv.conf
nameserver 8.8.8.8
Can you launch the playbook with increased verbosity to analyze the failure?
Maybe it could be useful the debug feature to shorten the test:
Unfortunatly at the moment I'm not on a rhel host.
Try also to check audit log for selinux restrictions
sealert -a /var/log/audit.log
regards
Luca