Introduction to Ansible Transcripts
Chapter: Deployments
Lecture: Enhancing Our Playbook and Let's Encrypt

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We need to improve our Ansible playbook
0:02 and get our domain set up cause right now
0:04 if we try to go to
0:07 nothing happens and that's to be expected.
0:09 Cause there is no application currently running
0:11 and engine.exe is not configured
0:13 to handle responding to this domain name.
0:15 Let's start modifying our Ansible playbook.
0:17 You can either take the playbook
0:19 that you've been working with so far
0:20 or if you go into the book and video code
0:23 examples repository, intro Ansible
0:27 you can copy configuring servers chapter as a starting point
0:30 for what we're going to work on in this chapter.
0:35 Let's actually copy Configuring Servers
0:37 to a new folder name, named flask-deploy
0:40 because we're going to deploy an example flask application.
0:44 Move in to the flask-deploy directory
0:47 this will be our starting point for chapter seven.
0:50 I still have all our variables and roles from the
0:52 previous chapter, let's start off by going under web server.
0:57 First thing we're going to want to do is make sure
1:00 that we have the Let's Encrypt package installed.
1:04 You can copy the same lines that we had
1:06 for entering Nginx installed
1:12 and use the Let's Encrypt package.
1:14 We'll also want to create a directory for Let's Encrypt.
1:25 Use the file module for this and with the file module
1:27 we can say state is equal to a directory.
1:31 Alright, let's run this as our first
1:35 modification to our playbook.
1:37 Now one step you may or may not have to take
1:39 if you are working with your existing playbook
1:40 you'll have your public and private keys already in there.
1:43 If you don't, and you just copied the directory
1:45 out of the Git repository, you will need
1:48 to either create public/private keys
1:50 or use the ones that you are already working with.
1:52 We're going to copy public/private keys
1:54 from our server config directory used last chapter.
2:02 Now we'll be able to kick off our playbook
2:04 and it'll use the private key to log into our servers.
2:09 Okay, so the issue here is that
2:10 we have permission denied, we did not use become:yes
2:14 in our playbook, let's modify that task
2:22 for create Let's Encrypt directory
2:24 so that we are using our superuser privileges
2:26 just as we did with the other tasks.
2:37 Okay so now we should have the Let's Encrypt package
2:39 installed on our web server only.
2:40 We can go ahead, upgrading our
2:42 web server configuration to HTTPS.