Introduction to Ansible Transcripts
Lecture: Learning Ansible Modules by Deploying
0:00 In this chapter
0:01 we're going to take all the knowledge
0:02 that we've learned throughout the course
0:03 and we're going to put it together into a complete playbook
0:05 that will deploy an application.
0:07 We are going to use a Python web application
0:09 as our example.
0:10 But if you have limited knowledge
0:11 of how to build and operation Python applications
0:14 that should not matter to you learning how to use
0:16 more features of Ansible.
0:17 Our example application is a simple prototype
0:20 Git Commit History Dashboard built with Python in Flask.
0:24 There isn't much to this application.
0:26 It's a work-in-progress.
0:27 It's exactly the type of early application
0:29 that we'd want to be able to deploy to a server
0:31 so that we could show it off to somebody
0:32 and get feedback on it. Here's what it looks like.
0:35 To access the application source code
0:37 it's all open source under the MIT license
0:47 Here's how our deployment is going to be structured.
0:49 Some of this is already in place
0:51 so while there are a lot of pieces here
0:52 in this chapter we're really just going to be adding
0:54 the new components, beyond what we had
0:57 in our playbook from the previous chapter.
0:58 As with most applications, you're going to have a bunch
1:01 of users, which is what it's in the top left corner
1:03 of this diagram.
1:04 They may be accessing your application
1:05 from phones, tablets, web browsers on their laptops
1:09 and desktop computers
1:10 and you're going to have your development environment
1:12 as well where you are building the application.
1:13 So what we need are a way to get the source code on to
1:16 our remote servers
1:17 and we need a way for users to be able
1:19 to access the application via the internet.
1:21 Here are the components that we have in place so far
1:23 and what we're going to set up throughout the chapter.
1:25 The first step is going to be getting a URL.
1:27 We're going to be use ansibledeploymentexample.com.
1:30 We use the domain name system to have that URL correspond
1:33 to an IP address, which is our web server
1:35 which we already have set up.
1:37 That web server, which is running Nginx
1:39 while like any good web server should be running
1:41 HTTP secure, HTTPS.
1:43 We'll grab a free certificate from Let's Encrypt
1:45 and we're going to automate this whole process
1:47 so that whatever applications you decide to deploy
1:49 in the future, you can customize your playbook
1:51 run it again, and every single step is automated.
1:54 No manual configuration that you're going to have to do.
1:56 Once we have our HTTPS certificate
1:58 we have to get our source code onto the server.
2:01 Now that source code is stored on GitHub
2:03 which we us our local development environment
2:05 to create the code, write the code, then push up GitHub.
2:07 Then from our web server, we're going to obtain
2:09 that source code from GitHub.
2:10 Once we got the source code
2:11 we can handle the Python specific configuration
2:14 that's necessary, along with any static assets
2:16 that we have that we need to serve through our web server.
2:19 Our application will also have application dependencies
2:21 which we're going to need to grab from PyPI
2:24 which is the Python package index
2:26 which allows us to retrieve code library dependencies
2:28 such as our web framework Flask.
2:30 When our application is up and running
2:32 we'll then connect to the database
2:33 and we already have our database running
2:35 from the previous chapter
2:36 but we need to do some custom configuration
2:37 to make sure we can connect to it properly
2:39 and interact with it.
2:40 So that's how our deployment is going to go
2:41 throughout this chapter
2:42 and we're going to learn a bunch more Ansible modules.
2:44 Hopefully regardless of whether you're working
2:47 with Python web applications
2:49 or another programming language
2:50 and your just happen to be using Ansible
2:52 as your configuration tool
2:53 all of this knowledge will be helpful to you.
2:55 And with some tweaking
2:59 and other applications.
3:00 To grab all the code from this chapter
3:02 including the finished Ansible playbook
3:04 take a look at bit.ly/intro-ansible/ch7.
3:07 Let's dig in.