Introduction to Ansible Transcripts
Chapter: Development Environment Configuration
Lecture: SSH Keys on macOS

Login or purchase this course to watch this video and the rest of the course contents.
0:00 After installing and testing Ansible to make sure that it runs the next step is to create an SSH key. SSH keys are asymmetric keys.
0:08 Which means that the public and the private key are different. You can share the public key with whoever you want.
0:15 And, in fact, we're going to put the public key on remote servers. But a private key should never be shared.
0:20 When a server only allows login via SSH keys it will use the public key to determine if someone is trying to log in with a private key
0:28 regardless of the operating system that we're going to be using. We need to create an SSH key pair. Let's take a look at how to do that on macOS.
0:35 Back in the terminal we're going to run the ssh-keygen command. If we type it without any parameters it'll just use default settings.
0:44 We're going to use a few custom parameters with ssh-keygen. The first is to specify the type as RSA. The number of bits is 4096
0:52 which is the current standard that most people use. And we can specify a custom email address which in my case is
1:01 Now ssh-keygen will ask you where you want to save the public and private key pair. I'll store it in the directory that it's recommending
1:08 but I'm going to give it a different name because I don't want to overwrite the existing public and private keys that I have there.
1:14 I'll call this intro-ansible and press enter twice to not use a passphrase. And then we'll see a bunch of random art that represents the key's image.
1:21 And our keys are created. So if we take a look under the .ssh directory and then we look specifically using the grep command for intro-ansible
1:32 we'll see that we have the private key which is just called intro-ansible and then the public key which always has the .pub at the end
1:39 after ssh-keygen generates those keys. is the one that we're going to put on remote servers and intro-ansible is the one
1:46 that is going to allow us to verify that we are who we say we are when we want to connect to those servers.
1:51 Now that we have our public and private keys we can write and execute our first Ansible playbook.

Talk Python's Mastodon Michael Kennedy's Mastodon