Skip to content

Commit f56ee18

Browse files
holserclaude
authored andcommitted
(multiple) Fix SSH cleanup
Update clean_layout.yml to use cifmw_target_host variable for SSH jumper cleanup instead of hardcoding localhost. This ensures cleanup runs on the correct host in environments where the target host differs from localhost. Add sshd reload handler and notify it during SSH config cleanup tasks. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Sergii Golovatiuk <sgolovat@redhat.com>
1 parent 2633e1d commit f56ee18

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

roles/libvirt_manager/tasks/clean_layout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@
338338

339339
- name: Clean local ssh config
340340
vars:
341-
cifmw_ssh_jumper_target: 'localhost'
341+
cifmw_ssh_jumper_target: "{{ cifmw_target_host | default('localhost') }}"
342342
cifmw_ssh_jumper_config_dir: "{{ lookup('env', 'HOME') }}/.ssh"
343343
ansible.builtin.include_role:
344344
name: "ssh_jumper"

roles/ssh_jumper/handlers/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
- name: Reload sshd
18+
become: true
19+
delegate_to: "{{ cifmw_ssh_jumper_target | default(omit) }}"
20+
ansible.builtin.systemd_service:
21+
name: sshd
22+
state: reloaded

roles/ssh_jumper/tasks/cleanup.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
- name: Remove Include cifmw_ssh_config.d
1818
delegate_to: "{{ cifmw_ssh_jumper_target | default(omit) }}"
19+
notify: Reload sshd
1920
vars:
2021
_path: >-
2122
{{
@@ -29,6 +30,7 @@
2930

3031
- name: Remove cifmw_ssh_config.d directory
3132
delegate_to: "{{ cifmw_ssh_jumper_target | default(omit) }}"
33+
notify: Reload sshd
3234
vars:
3335
_path: >-
3436
{{

0 commit comments

Comments
 (0)