-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathretire.yaml
39 lines (37 loc) · 1.06 KB
/
retire.yaml
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
gather_facts: false
hosts: localhost
vars:
# Fixes selinux issue w/ virtualenv
ansible_python_interpreter: "/usr/bin/python"
tasks:
- name: Clean up ~/.ssh/known_hosts
when:
- cleanup_known_hosts is defined
- cleanup_known_hosts
block:
- name: Remove Lines w/ Inventory Hostname in known_hosts
ansible.builtin.lineinfile:
dest: ~/.ssh/known_hosts
regexp: "^.*{{ item }}.{{ base_domain }}.*$"
state: absent
loop: "{{ groups[provision_group] }}"
- name: Remove Lines w/ Inventory IP in known_hosts
ansible.builtin.lineinfile:
dest: ~/.ssh/known_hosts
regexp: "^.*{{ lookup('dig', item) }}.*$"
state: absent
loop: "{{ groups[provision_group] }}"
- name: Retire Integrated VMs in Bulk
gather_facts: false
hosts: localhost
vars_files:
- vault.yaml
roles:
- role: vmware_retire
tags:
- vmware
- role: ipa_retire
tags:
- ipa