-
Notifications
You must be signed in to change notification settings - Fork 27
/
retire.yml
39 lines (37 loc) · 1.02 KB
/
retire.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: Cleanup Local known_hosts File
hosts: localhost
vars:
# Fixes selinux issue w/ virtualenv
ansible_python_interpreter: "/usr/bin/python"
tasks:
- name: Clean up ~/.ssh/known_hosts
block:
- name: Remove Lines w/ Inventory Hostname in known_hosts
lineinfile:
dest: ~/.ssh/known_hosts
state: absent
regexp: "^.*{{ item }}.{{ base_domain }}.*$"
with_items:
- "{{ groups[provision_group] }}"
- name: Remove Lines w/ Inventory IP in known_hosts
lineinfile:
dest: ~/.ssh/known_hosts
state: absent
regexp: "^.*{{ lookup('dig', item) }}.*$"
with_items:
- "{{ groups[provision_group] }}"
when:
- cleanup_known_hosts is defined
- cleanup_known_hosts
- name: Retire Integrated VMs in Bulk
hosts: localhost
vars_files:
- vault.yml
roles:
- role: rhv-retire
tags:
- rhv
- role: ipa-retire
tags:
- ipa