python - How do i give ssh keys for multiple hosts from terminal command line in fabric -
i want test various package installation on multiple hosts. different hosts have different password/ssh-key.
i dont want hard code host name , ssh-key in fab file. how can pass multiple host , ssh-key through terminal command line.
code in fab file looks -
fabric.api import settings, run, env def test_installation(cmd): run("dpkg -s %s" %cmd) and calling -
fab test_installation:tomcat7 --hosts "user1@host1:port","vuser2@host2:port" -i "ssh-file-path host1","ssh-file-path host2" please suggest me proper way. welcomed.
you don't provide ssh keys of hosts, your ssh key, used register in authorized_keys on host. , provide path (usually ~/.ssh/id_rsa).
moreover, can configure fabric use ssh config, don't need hardcode path @ all. can use same keys, use if typed ssh my_host in shell.
how can find in fabric tutorial:
http://docs.fabfile.org/en/1.8/usage/execution.html#leveraging-native-ssh-config-files
http://docs.fabfile.org/en/1.8/usage/env.html#full-list-of-env-vars
you can set ~/.ssh/config use different key different host. if not familiar ssh , configuring it, please see:
Comments
Post a Comment