Introduction to Ansible Transcripts
Chapter: Development Environment Configuration
Lecture: SSH Keys on Ubuntu
0:00 We need to create an SSH key so that we can properly control from our computer, all other computers that we're going to configure using Ansible.
0:08 On Ubuntu, we create SSH keys using the ssh-keygen command. Type ssh-keygen and then the type of key that we want to create is RSA.
0:18 We're going to have 4,096 bits and you can also customize with the -C what you want your email address to be for this particular key.
0:28 So I'll just put mine as email@example.com Now I typically save. ssh-keygen will ask you where you want to save
0:35 both the public and the private keys. I don't use the default value what I do is give it a specific name that allows me to later reference
0:44 and understand what that key is being used for. So for this one, call it intro-ansible and store it under your home directory
0:50 within the .ssh subdirectory. Don't specify a passphrase. And now we'll have two files that have been created when we take a look at that directory
0:58 that we just specified. The first one is our private key. The private key should never be shared publicly. This is what is going to authenticate you
1:08 that you have access to a server. The public key can be shared widely in fact it can even be uploaded to GitHub if you want.
1:13 We're going to put this on remote servers because we are the only ones with access to the corresponding private key.
1:19 Occasionally we'll also even need to just copy and paste our public key. And what I do for that is that I use the cat command.
1:31 And then you can copy and paste directly from the terminal. You'll never want to do that for the private key
1:36 but for the public key, you can share that freely. And later what we'll see is we'll copy and paste the public key when we're provisioning servers.
1:42 Now that we have our environment setup we can dig into the core concepts of Ansible.