Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Image Modified


!!!! Read before starting:     if ansible run as root >>>>> use root's   id_rsa   file !!!!

!!!! But if it's for Juniper, use the user account to log into the router !!!!

juniper.junos module does not send a file to the router, but use netconfig


1- create the Private key & Public key ( .pub) on the Client:       ssh-keygen
2- copy the public key to the server:               ssh-copy-id   or just a sftp
3- To set up SSH agent to avoid retyping passwords, you can do:
4- SSH test ( will ask for the passphrase once!)
5- check the Local keys:
6- check the Remote keys:

...

or just copy the file using  ( if ssh-copy-id not supported ):

scp id_rsa.pub  ansible@192.168.99.111:/var/home/ansible/

sftp ansible@192.168.99.11 ( then put /project/id_rsa.pub /var/home/ansible/id_rsa.pub ) 

...


Code Block
titlesftp ansible@192.168.99.11
collapsetrue
scp  id_rsa.pub ansible@192.168.99.111:/var/home/
Password:
id_rsa.pub                                                        100%  520    77.8KB/s   00:00

or

/project # sftp root@192ansible@192.168.99.11
root@192ansible@192.168.99.11's password:
Connected to 192.168.99.11.
sftp> put /rootvar/home/.ssh/id_rsa.pub  /rootvar/home/.ssh/id_rsa.pub
Uploading /var/roothome/.ssh/id_rsa.pub to /rootvar/home/.ssh/id_rsa.pub
/var/roothome/.ssh/id_rsa.pub                                                       100%  386   502.9KB/s   0.4KB/s   00:00

sftp> ls .ssh/
id_rsa.pub

sftp> pwd
Remote working directory: /var/home/root

sftp> exit
/project #


Code Block
titleafter reboot
After a reboot of the server the key may change, will need to be reload on the vMX!



Check:  after the ssh-copy-id, on the remote server: before/after   ( /root/.ddh  or /home/<username>/.ssh/ )



...