Connecting to Juniper devices
In this recipe, you will connect to Juniper devices via SSH in order to start managing the devices from Ansible. SSH is a common connection point, with the added benefit that network engineers are familiar with it.
- Create private and public SSH keys in the
ch05working directory:root@cookbook-lab:~/cookbook-lab/chapters/ch05# ssh-keygen -t rsa -b 2048 -f Ansible_SSH_key (1) Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in Ansible_SSH_key Your public key has been saved in Ansible_SSH_key.pub The key fingerprint is: SHA256:2fQreD37u5d5IVmciHu1Lh8vLQZmFaU2FLNmbFvCAMk ... omitted output ...
The numbered reference from the preceding code is explained as follows:
(1) ssh-keygen is executed to generate the private and public keys:
We specify the encryption algorithm with the -t option. Here, it is set to rsa.