Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 935 Bytes

vagrant-configure-sshkey.md

File metadata and controls

14 lines (10 loc) · 935 Bytes

Generate And Add A secure ssh key to the target machines to simplify connecting to them by ansible when we run the playbook from jenkins

ssh-keygen -ted25519 -C "Webservers-ssh Key-key generated by AbdullahAbaza" name it : id_ed25519_webservers_key mv id_ed25519_webservers_key id_ed25519_webservers_key.pub ./.ssh/

make sure the old private keys have the correct permitions

chmod 600 ~/.ssh/machines/m01/virtualbox/private_key chmod 600 ~/.ssh/machines/m02/virtualbox/private_key

copy the new key to the machines

cat ~/.ssh/id_ed25519_webservers_key.pub | ssh -i ~/.ssh/machines/m01/virtualbox/private_key vagrant@192.168.73.2 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

cat ~/.ssh/id_ed25519_webservers_key.pub | ssh -i ~/.ssh/machines/m02/virtualbox/private_key vagrant@192.168.73.3 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"