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