how to get fingerprint of cluster master by commnad line

Sep 14, 2020
57
6
13
47
I'm creating a bash script to try to join nodes in a cluster automatically.

When I try to join the node to the cluster, with the pvecm command, it asks if I want to accept the figerprint and also asks the password of the superuser of the master node. Theoretically I would be able to pass the fingerprint as a parameter on the command line, using "--fingerprint". However, I don't know how to get this fingerprint code from the master node automatically, through the CLI, without having to look at the GUI to pass it through the command line. I also don't know how to pass this password through the command parameter.

Code:
pvecm add $ipv4_cluster -link0 $no_vlan8_address --fingerprint 62:21:29:A4:33:0E:18:62:A1:12:59:29:E3:6B:03:2C:DA:78:9B:B5:E4:3E:95:C9:D6:5E:6A:F1:BE:M3:15:86

Two questions:

- Would it be possible to get the fingerprint in advance before entering the pvecm command, with an another shell command (without looking at Web UI) on the master node or on the node that I'm adding?
- Would it be possible to pass this superuser password by parameter to the pvecm command, so that it does not open a prompt asking for the password?

Tanks!
 
However, I don't know how to get this fingerprint code from the master node automatically,

The idea is that you "verify" the fingerprint. This can't be done automatically.

If you really want to automate, you need to connect to the new node and get
the fingerprint from there using:

# pvenode cert info
 
Last edited:
The idea is that you "verify" the fingerprint. This can't be done automatically.

If you really want to automate, you need to connect to the new node and get
the fingerprint from there using:

# pvenode cert info

Great!

And now, how can I pass the superuser password as a parameter to the "pvecm add" command? I would like to have as little user intervention as possible.

Tanks
 
I have been playing also with the automation of cluster creation.

My solution is using Expect. I am using Ansible for many other tasks, so I have used the Expect module for Ansible. But you can use Expect program for Linux.

This is my ansible task to add a node to my cluster. I have a previous task that creates the cluster ( pvecm create {{ CLUSTER_NAME }} )

YAML:
- name: Adding node '{{ ansible_hostname }}' to cluster '{{ CLUSTER_NAME }}'.
      become: yes
      become_user: root
      expect:
        command: pvecm add {{ CLUSTER_MASTER_NODE_IP }}
        responses:
          'Password for': "{{ CLUSTER_MASTER_NODE_ROOT_PASSWORD }}"
          '(?i)fingerprint': "yes"
      # you don't want to show passwords in your logs
      no_log: true
        echo: yes
        timeout: 60
      when: ansible_hostname != CLUSTER_MASTER_NODE_HOSTNAME
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!