Skip to content
Snippets Groups Projects
Commit 13541ea5 authored by jurgenhaas's avatar jurgenhaas
Browse files

Cleanup known_hosts and host file

parent b463b7e7
No related branches found
No related tags found
No related merge requests found
---
# file: cleanup.yml
- name: "Remove host from known_hosts"
known_hosts:
name="{{ item }}"
state="absent"
with_items:
- '{{ static_ipv4|default(False) }}'
- '{{ host }}'
- name: "Remove host from hosts file"
lineinfile:
dest=/etc/hosts
regexp='{{ item }}'
state=absent
sudo: yes
with_items:
- '^{{ static_ipv4|default(False) }} '
- '.*{{ host }}$'
---
# file: inithost.yml
- include: "cleanup.yml"
......@@ -2,3 +2,5 @@
# file: roles/cloud/tasks/main.yml
- include: "{{ cloud|default('none') }}/{{ mode }}.yml"
- include: "{{ mode }}.yml"
---
# file: removehost.yml
- include: "cleanup.yml"
when: are_you_sure == "YES"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment