diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index 12c3399edf62265d7403154fd7b6d93f484ddacf..ab9e61ed0bf44e56b52d36af0d09ee67e4a56dc4 100644 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -9,7 +9,7 @@ - '{{ static_ipv4|default(False) }}' - '{{ host }}' -- name: "Remove host from hosts file" +- name: "Remove host from hosts file 1" lineinfile: dest=/etc/hosts regexp='{{ item }}' @@ -17,4 +17,12 @@ become: yes with_items: - '^{{ static_ipv4|default(False) }} ' + +- name: "Remove host from hosts file 2" + lineinfile: + dest=/etc/hosts + regexp='{{ item }}' + state=absent + become: yes + with_items: - '.*{{ host }}$'