How to use Python to manage each node in batches, because I want to send some scripts to nodes in batches

By default, find the management in engine-web and use ssh management to restart and stop the node node. Can I get the host's secret key or other login information to log in through Python, and then send some commands or scripts?

I have found a solution to log in to each host without password

Not sure what you did. But this seems more like normal server management. Not sure what you are trying to do, but it seems like ansible might fit the bill here. On Thu, Aug 17, 2023, 11:14 PM ziyi Liu <lzy19930211@gmail.com> wrote:
I have found a solution to log in to each host without password _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/TU3SDAR2RBDYSF...

Hi, Liu. Can you share with us your solution? Cheers. Em sex., 18 de ago. de 2023 às 00:33, Wesley Stewart <wstewart3@gmail.com> escreveu:
Not sure what you did. But this seems more like normal server management. Not sure what you are trying to do, but it seems like ansible might fit the bill here.
On Thu, Aug 17, 2023, 11:14 PM ziyi Liu <lzy19930211@gmail.com> wrote:
I have found a solution to log in to each host without password _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/TU3SDAR2RBDYSF...
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/YMZLJ5H5PLDD7G...
-- Att, Jorge Visentini +55 55 98432-9868

import ovirtsdk4 as sdk import paramiko import subprocess # create connection connection = sdk.Connection( url='https://xxx/ovirt-engine/api', username='xxx', password='xxx', ca_file= 'cacert.pem', ) This above is using the api format # Get all hosts hosts_service = connection.system_service().hosts_service() hosts = hosts_service. list() #By obtaining the fqdn of the host to perform ssh In the engine web, you can restart the host and stop some operations. I thought that the engine and node host may have been encrypted, so I found the engine_id_rsa key in /etc/pki/ovirt-engine/ /etc/pki/ovirt-engine/keys/engine_id_rsa Use this secret-free key to ssh to the obtained host
participants (4)
-
Jorge Visentini
-
Wesley Stewart
-
ZiYi Liu
-
ziyi Liu