Merge "Fix known_hosts module issue on centos/rocky 10"

This commit is contained in:
Zuul
2025-08-20 00:24:55 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 2 deletions

View File

@@ -61,8 +61,10 @@
user: "{{ ansible_facts.user_id }}"
key: "{{ lookup('file', bootstrap_ssh_private_key_path ~ '.pub') }}"
# NOTE(priteau): Exclude comments from ssh-keyscan output because they break
# known_hosts on centos/rocky 10.
- name: Scan for SSH keys
command: ssh-keyscan {{ item }}
shell: ssh-keyscan {{ item }} | grep -v '^#'
with_items:
- localhost
- 127.0.0.1

View File

@@ -13,9 +13,11 @@
vm provision' and 'kayobe overcloud inventory discover'.
when: not ansible_host | default(inventory_hostname)
# NOTE(priteau): Exclude comments from ssh-keyscan output because they break
# known_hosts on centos/rocky 10.
- name: Scan for SSH keys
local_action:
module: command ssh-keyscan {{ item }}
module: shell ssh-keyscan {{ item }} | grep -v '^#'
with_items:
- "{{ ansible_host | default(inventory_hostname) }}"
register: keyscan_result