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 for both our servers. Now let's get started on the common role
0:07
which will handle the next task of hardening the servers against malicious actors and setting up some basic configuration
0:13
that we'll need a web server and the database server. Go into roles/common and create a new directory named tasks.
0:22
Under tasks, create a file named main.yml We're going to create a file named security.yml which will install the security packages
0:40
except the firewall that we need for our server. Save main.yml, let's create security.yml. We're going to write a single so that we can test this out
0:47
and make sure everything works. And the first task will just install some packages that we need on Ubuntu. Use the apt, aptitude module.
1:05
We're going to give the apt module a list of items we'll define in just a moment. We want to update the cache before install any packages
1:14
to make sure we have the latest versions available. And we're going to need to use superuser privileges. We can give a list of items
1:22
that are the name of the packages that we want to install. We're going to install some Python 3.0 development packages
1:33
and Fail2ban which prevents unauthorized access attempts. Save that file and let's test it out.