Introduction to Ansible Transcripts
Chapter: Configuring Servers
Lecture: Installing System Packages with the apt Module

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We've created a non-route deployer user
0:02 for both our servers.
0:03 Now let's get started on the common role
0:06 which will handle the next task of hardening the servers
0:09 against malicious actors
0:10 and setting up some basic configuration
0:12 that we'll need a web server and the database server.
0:16 Go into roles/common
0:18 and create a new directory named tasks.
0:21 Under tasks, create a file named main.yml
0:35 We're going to create a file named security.yml
0:37 which will install the security packages
0:39 except the firewall that we need for our server.
0:41 Save main.yml, let's create security.yml.
0:44 We're going to write a single so that we can test this out
0:46 and make sure everything works.
0:50 And the first task will just install some packages
0:53 that we need on Ubuntu.
0:59 Use the apt, aptitude module.
1:04 We're going to give the apt module a list of items
1:08 we'll define in just a moment.
1:10 We want to update the cache before install any packages
1:13 to make sure we have the latest versions available.
1:15 And we're going to need to use superuser privileges.
1:19 We can give a list of items
1:21 that are the name of the packages that we want to install.
1:30 We're going to install some Python 3.0 development packages
1:32 and Fail2ban which prevents unauthorized access attempts.
1:35 Save that file and let's test it out.