Introduction to Ansible Transcripts
Chapter: Configuring Servers
Lecture: Running Nginx

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We have our firewall configured, so let's go ahead and start installing some services on our servers. We're going to start with the web server.
0:07 Let's install Nginx and then we'll modify it with a custom configuration. First step, go back under roles, and we're going to go
0:13 into web server under tasks, modify main.yml and this time we're going to include nginx.yml. Save that file and then let's create nginx.yml.
0:28 We'll start out with a single task. This is going to use the apt module. We're going to want to install the Nginx package.
0:38 Now if it's already installed, Ansible will just check to make sure that it's installed and then skip this step.
0:42 And if it's not installed, it will go ahead and install the package. We do need super user privileges for this and we'll save the file.
0:55 Let's go ahead and run our Playbook. Make sure we didn't make any typos here. Ansible Playbook, typical private key webanddatabase.yml, user host file.
1:06 Now it may pause here for a few seconds usually this is the first time we've installed this so it's going to actually install Nginx.
1:12 Ran successfully, great, now we can test to see whether it installed or not. Copy and paste the IP address from the host file.
1:24 Flip over into Chrome, and we get a welcome to Nginx so this is because we just installed Nginx and it's using the default, boilerplate for a web page
1:33 that it displays when we access the IP address. Now we have Nginx installed. Now we can go ahead, modify the configuration
1:39 using a template install https.


Talk Python's Mastodon Michael Kennedy's Mastodon