-f $clusterconf && die "cluster config '$clusterconf' already exists\n";
- PVE::Cluster::setup_sshd_config();
+ PVE::Cluster::setup_sshd_config(1);
PVE::Cluster::setup_rootsshconfig();
PVE::Cluster::setup_ssh_keys();
my $nodename = PVE::INotify::nodename();
- PVE::Cluster::setup_sshd_config();
+ PVE::Cluster::setup_sshd_config(1);
PVE::Cluster::setup_rootsshconfig();
PVE::Cluster::setup_ssh_keys();
code => sub {
my ($param) = @_;
+ PVE::Cluster::setup_sshd_config(0);
PVE::Cluster::setup_rootsshconfig();
PVE::Cluster::gen_pve_vzdump_symlink();
}
sub setup_sshd_config {
+ my ($start_sshd) = @_;
my $conf = PVE::Tools::file_get_contents($sshd_config_fn);
PVE::Tools::file_set_contents($sshd_config_fn, $conf);
- PVE::Tools::run_command(['systemctl', 'reload-or-restart', 'sshd']);
+ my $cmd = $start_sshd ? 'reload-or-restart' : 'reload-or-try-restart';
+ PVE::Tools::run_command(['systemctl', $cmd, 'sshd']);
}
sub setup_rootsshconfig {