I use file.blockreplace like this:
etc_sudoers_{{ system_name }}:
file.blockreplace:
- name: /etc/sudoers
- marker_start: "# START etc_sudoers_{{ system_name }} -DO-NOT-EDIT-"
- marker_end: "# END etc_sudoers_{{ system_name }} --"
- content: |
{{system_name}} ALL = NOPASSWD: /bin/systemctl restart apache2*
- append_if_not_found: True
- show_changes: True
This creates an entry in the file like this:
# START etc_sudoers_foo_c123_dpci01051321 -DO-NOT-EDIT-
foo_c123_dpci01051321 ALL = NOPASSWD: /bin/systemctl restart apache2*
# END etc_sudoers_foo_c123_dpci01051321 --
Now I want to remove the whole block (inclusive the START/END markers). How to do this with saltstack?