In etc_host sketch, a (regex) list of ips passed to delete_nonmanaged bundle to delete lines do not match ips or are not comments.

caller :

edit_line   => cfdc_etc_hosts:delete_nonmanaged("@(configure.ip)"),

delete_nonmanaged bundle:

bundle edit_line delete_nonmanaged(ips)
{
  vars:
      "regex" string => join ("|", "ips"),
      comment => "Or the escaped ips together so we can delete all others.";

  delete_lines:
      # This is the negative look ahead, and what would need tweaked
      # if you don't like the behavior. Specifically it's identifying
      # our list of ips followed by a space, as well as # comment or
      # localhost and deleting everything else

      "^(?!(\#|127\.0\.0\.1|\:\:1|$(regex))\s.*).*$"
      comment => "Delete lines do not match our ips or are not comments";
}