#!/bin/bash

# CONFIG
USERNAME="root"
PASSWD="Porolonka330"  # Удалите эту строку, если используете SSH-ключи
HOSTS=("10.0.9.236" "10.0.8.93" "10.0.14.39" "10.0.7.32" "10.0.15.83" "10.0.13.170" "10.0.13.226" "10.0.7.47" "10.0.3.166" "10.0.15.139" "10.0.8.30" "10.0.2.143" "10.0.10.105" "10.0.5.178" "10.0.17.221" "10.0.11.77" "10.0.17.134" "10.0.18.12")
USER="m1"  # RLNAME для всех хостов
remote_command="pveum usermod m1@pve -enable 1"

for i in ""${!HOSTS[@]}""; do
  host=""${HOSTS[$i]}""
  sshpass -p "$PASSWD" ssh -o StrictHostKeyChecking=no "$USERNAME@$host" "$remote_command"
    #ssh -o StrictHostKeyChecking=no "$USERNAME@$host" "$remote_command"

    echo "Выполнено: ssh $USERNAME@$host \"$remote_command\""
done

echo "Скрипт завершен."

