Introduction to Ansible Transcripts
Chapter: Configuring Servers
Lecture: Running Nginx
0:00 We have our firewall configured, so let's go ahead
0:02 and start installing some services on our servers.
0:04 We're going to start with the web server.
0:06 Let's install Nginx and then we'll modify it
0:08 with a custom configuration.
0:10 First step, go back under roles, and we're going to go
0:12 into web server under tasks, modify main.yml
0:17 and this time we're going to include nginx.yml.
0:20 Save that file and then let's create nginx.yml.
0:27 We'll start out with a single task.
0:32 This is going to use the apt module.
0:34 We're going to want to install the Nginx package.
0:37 Now if it's already installed, Ansible will just check
0:39 to make sure that it's installed and then skip this step.
0:41 And if it's not installed, it will go ahead
0:43 and install the package.
0:47 We do need super user privileges for this
0:51 and we'll save the file.
0:54 Let's go ahead and run our Playbook.
0:56 Make sure we didn't make any typos here.
0:58 Ansible Playbook, typical private key
1:00 webanddatabase.yml, user host file.
1:05 Now it may pause here for a few seconds
1:07 usually this is the first time we've installed this
1:08 so it's going to actually install Nginx.
1:11 Ran successfully, great, now we can test
1:14 to see whether it installed or not.
1:19 Copy and paste the IP address from the host file.
1:23 Flip over into Chrome, and we get a welcome to Nginx
1:27 so this is because we just installed Nginx
1:29 and it's using the default, boilerplate for a web page
1:32 that it displays when we access the IP address.
1:35 Now we have Nginx installed.
1:36 Now we can go ahead, modify the configuration
1:38 using a template install https.