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: