Skip to content

Commit 5ad8b51

Browse files
authored
Merge pull request #184 from btravouillon/fix/no_pve_manage_ssh
Check for pve_manage_ssh in pve_add_node.yml
2 parents a8f5ad9 + 42d7c0e commit 5ad8b51

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ joining the cluster, the PVE cluster needs to communicate once via SSH.
224224
would make to your SSH server config. This is useful if you use another role
225225
to manage your SSH server. Note that setting this to false is not officially
226226
supported, you're on your own to replicate the changes normally made in
227-
ssh_cluster_config.yml.
227+
`ssh_cluster_config.yml` and `pve_add_node.yml`.
228228

229229
`interfaces_template` is set to the path of a template we'll use for configuring
230230
the network on these Debian machines. This is only necessary if you want to

tasks/pve_add_node.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
---
2-
- name: Identify the SSH public key and SSH addresses of initial cluster host
3-
ansible.builtin.set_fact:
4-
_pve_cluster_host_key: "{{ ' '.join((hostvars[_init_node]._pve_ssh_public_key.content | b64decode).split()[:-1]) }}"
5-
_pve_cluster_host_addresses: "{{ hostvars[_init_node].pve_cluster_ssh_addrs | join(',') }}"
2+
- block:
3+
- name: Identify the SSH public key and SSH addresses of initial cluster host
4+
ansible.builtin.set_fact:
5+
_pve_cluster_host_key: "{{ ' '.join((hostvars[_init_node]._pve_ssh_public_key.content | b64decode).split()[:-1]) }}"
6+
_pve_cluster_host_addresses: "{{ hostvars[_init_node].pve_cluster_ssh_addrs | join(',') }}"
67

7-
- name: Temporarily mark that cluster host as known in root user's known_hosts
8-
ansible.builtin.blockinfile:
9-
dest: /root/.ssh/known_hosts
10-
create: yes
11-
mode: 0600
12-
marker: "# {mark}: cluster host key for joining"
13-
content: "{{ _pve_cluster_host_addresses }} {{ _pve_cluster_host_key }}"
8+
- name: Temporarily mark that cluster host as known in root user's known_hosts
9+
ansible.builtin.blockinfile:
10+
dest: /root/.ssh/known_hosts
11+
create: yes
12+
mode: 0600
13+
marker: "# {mark}: cluster host key for joining"
14+
content: "{{ _pve_cluster_host_addresses }} {{ _pve_cluster_host_key }}"
15+
when: "pve_manage_ssh | bool"
1416

1517
- name: Add node to Proxmox cluster
1618
ansible.builtin.command: >-
@@ -30,3 +32,4 @@
3032
state: absent
3133
mode: 0600
3234
marker: "# {mark}: cluster host key for joining"
35+
when: "pve_manage_ssh | bool"

0 commit comments

Comments
 (0)