Hi,
> cat fabfile.py > from fabric import task, Connection @task > def check_kernel_version(c): > password = 'dac@123' > connect_kwargs = {'password': password} > connection = Connection(host="192.168.0.188", user="root", > connect_kwargs=connect_kwargs) > result = connection.run('uname -a') @task > def check_os_version(c): > connect_kwargs={"key_filename": "/Users/kaushalshriyan/.ssh/id_rsa"} > for host in ('192.168.0.167', '192.168.0.79', '192.168.0.151'): > connection = Connection(host="host", user="root", > connect_kwargs=connect_kwargs) > result = connection.run('uname -a') $ fab2 check-kernel-version Linux hsbcobsstomcatbahrainms 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/bin/fab2", line 8, in <module> sys.exit(program.run()) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/invoke/program.py", line 384, in run self.execute() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/invoke/program.py", line 566, in execute executor.execute(*self.tasks) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/invoke/executor.py", line 129, in execute result = call.task(*args, **call.kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/invoke/tasks.py", line 127, in __call__ result = self.body(*args, **kwargs) File "/Users/kaushalshriyan/fabfile.py", line 15, in check_os_version result = connection.run('uname -a') File "<decorator-gen-10>", line 2, in run File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/fabric/connection.py", line 29, in opens self.open() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/fabric/connection.py", line 636, in open self.client.connect(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/paramiko/client.py", line 340, in connect to_try = list(self._families_and_addresses(hostname, port)) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/paramiko/client.py", line 203, in _families_and_addresses addrinfos = socket.getaddrinfo( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 953, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 8] nodename nor servname provided, or not known $ I have defined def check_kernel_version(c) in the fabile.py but when i $fab2 check_kernel_version No idea what 'check_kernel_version' is! $fab2 check-kernel-version Linux hsbcobsstomcatbahrainms 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux I am not sure how does it work? For $ fab2 check-os-version I am encountering socket.gaierror: [Errno 8] nodename nor servname provided, or not known Please guide. Thanks in advance. Best Regards, Kaushal