From 04f0b365a5d6c51fc0ba312fb9eba5feadcbbbe2 Mon Sep 17 00:00:00 2001 From: Musee Ullah Date: Wed, 19 Apr 2023 00:31:02 +0900 Subject: [PATCH] Specify port in known_hosts when adding cluster nodes. Fixes #221 --- tasks/pve_add_node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/pve_add_node.yml b/tasks/pve_add_node.yml index f96d1f81..a27a1395 100644 --- a/tasks/pve_add_node.yml +++ b/tasks/pve_add_node.yml @@ -3,7 +3,7 @@ - name: Identify the SSH public key and SSH addresses of initial cluster host ansible.builtin.set_fact: _pve_cluster_host_key: "{{ ' '.join((hostvars[_init_node]._pve_ssh_public_key.content | b64decode).split()[:-1]) }}" - _pve_cluster_host_addresses: "{{ hostvars[_init_node].pve_cluster_ssh_addrs | join(',') }}" + _pve_cluster_host_addresses: "{{ hostvars[_init_node].pve_cluster_ssh_addrs | map('regex_replace', '^(.*)$', (pve_ssh_port == 22) | ternary('\\1', '[\\1]:' + (pve_ssh_port | string))) | join(',') }}" - name: Temporarily mark that cluster host as known in root user's known_hosts ansible.builtin.blockinfile: