Skip to content

Commit

Permalink
Correct ssh configuration cleaning
Browse files Browse the repository at this point in the history
While the hypervisor name was added to the "mark" on the laptop, we
don't have it when we update the config on the hypervisor itself.

This patch corrects the wrong cleaning.

In order to ensure environment are in a right state, it also ensures
older configuration "marker" are removed from the laptop. This block may
be removed in a few weeks.
  • Loading branch information
cjeanner authored and openshift-merge-bot[bot] committed Apr 16, 2024
1 parent 9c594df commit 539cd79
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion roles/libvirt_manager/tasks/clean_layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,25 @@
create: true
loop: "{{ cleanup_vms }}"

- name: "(localhost) Clean old ssh jumpers"
when:
- inventory_hostname != 'localhost'
delegate_to: localhost
vars:
vm: "{{ item | replace('cifmw-', '') }}"
ansible.builtin.blockinfile:
path: "{{ lookup('env', 'HOME') }}/.ssh/config"
marker: "## {mark} {{ vm }}"
state: absent
create: true
loop: "{{ cleanup_vms }}"

- name: "({{ inventory_hostname }}) Clean ssh jumpers" # noqa: name[template]
vars:
vm: "{{ item | replace('cifmw-', '') }}"
ansible.builtin.blockinfile:
path: "{{ ansible_user_dir }}/.ssh/config"
marker: "## {mark} {{ vm }} {{ inventory_hostname }}"
marker: "## {mark} {{ vm }}"
state: absent
create: true
loop: "{{ cleanup_vms }}"
Expand Down

0 comments on commit 539cd79

Please sign in to comment.