Skip comment lines when adding host ssh keys

This commit is contained in:
Timo Makinen 2025-06-18 10:04:47 +00:00
parent e716951798
commit c8918b1a35

View file

@ -165,7 +165,7 @@
path: /root/.ssh/known_hosts
key: "{{ item }}"
host: "{{ inventory_hostname }}"
with_items: "{{ hostkeys.stdout.splitlines() }}"
with_items: "{{ hostkeys.stdout.splitlines() | reject('match', '^#.*') }}"
delegate_to: localhost
when: inventory_hostname not in result.list_vms