
This video provides an overview of the entire course.
In this section, you'll learn about the most popular uses of the Ansible automation tool. It's a tool that you can use to manage the full life cycle of your infrastructure.
Use of the Ansible automation tool
Ansible Security
Ansible is more than just configuration management, like many other tools in this space. It's also much more lightweight than competitors like Puppet and Chef—to configure a server, all you need is an SSH login and Python 2 installed.
Reasons to try Ansible
We'll use a simple example: installing and configuring an nginx server and a simple static HTML website, first using bash and then using Ansible.
A demonstration of how configuration management has changed over time
Differences between traditional bash and process in Ansible
An example on manual versus shell script versus playbook
This video gives you an overview of how the course is structured. The focus is on practical, real-world applications, since that prepares you for real-life application of this knowledge.
Install and set up the environment for Ansible
Basic configuration files
Cloud integration and Ansible tower
In this video, we'll cover the basic Ansible vocabulary. You'll have many basic questions answered.
What's the difference between a server and a machine?
What is an Ansible target machine?
How do Ansible tasks, plays, and playbooks fit together?
In this video, you'll learn about the new features and improvements that Ansible 2.0 offers.
Task blocks (which can make your code easier to read and reason about)
Dynamic includes (which can allow you to simplify your playbooks)
Execution strategies (which can dramatically improve Ansible's performance on large deployments)
In this video, we'll set up an environment that you can use to safely practice everything you see in this course.
Which type of VM to use for your Ansible Controller machine
How to set things up to make your learning experience comfortable
In this video, we’ll be installing Ansible on Ubuntu and further we’ll look two ways of version-based installation.
Install Ansible on Ubuntu
Two ways to install Ansible on Ubuntu
In this video, you'll learn the three most popular ways to install Ansible, and decide which one is right for you.
How to install Ansible through your package manager (if you just want a low-fuss install to learn with )
How to install Ansible through their third-party repository (PPA) in Ubuntu (if you want something more up-to-date)
How to install Ansible through pip (if you've already got a Python development environment set up)
Use the Ansible-provided script to set up your shell environment so that you can use your bleeding-edge Ansible code
In this video you'll learn how to simulate test machines with LXC (Linux Containers). LXC is a lightweight precursor to Docker which will let us configure some test hosts that we can run Ansible against.
Create three containers
Ansible only requires two things: Python 2 and a running SSH service. In this video, I'll show you the 10-second process that prepares a brand-new host for Ansible.
Automated by a playbook in one of the first pieces of Ansible code
In this video, you'll learn where Ansible looks for its primary configuration file, and the different ways in which you can approach configuring Ansible.
The top-level Ansible configuration file
The user-level Ansible configuration file
A config file in the directory that Ansible is being executed from
The ANSIBLE-CONFIG environment variable
How does Ansible know which hosts to configure? The Ansible Hosts (Inventory) file!
What the inventory file is?
Basic syntax for the Ansible inventory file
The top-level Ansible inventory file (/etc/ansible/hosts)
Ad-Hoc Commands are simple one-off commands that perform a single action on a target host. These simple replacements for small bash scripts or 'for' loops are run from the command-line, and work well for cases where a full-featured Playbook is overkill. You'll see Ad-Hoc commands for doing several things across one server, or many servers at once
Pinging and checking memory usage
Install a package
Add timeouts to your commands
Specify additional command-line arguments (custom users, ignoring host-key checking, etc.)
Playbooks are the Ansible feature you'll be working with on most projects. In this video, you'll learn the three components that make a Playbook what it is: tasks, templates, and handlers.
Discuss how Playbooks make code reuse easy
See some simple examples of practical playbooks
In this video, you'll learn how to structure your playbooks for maximum readability, predictability, and flexibility. You'll learn about Roles, and how they can help you reuse code. Note: For this course, we're not using every available Playbook feature, because it can make things excessively complex. We're focusing on the practical 90% of features that you'll be using every day.
Look at some Python code that creates an empty playbook template
Compare that to a playbook-creating Ansible playbook
In this video, you'll learn what Ansible modules are and how they help you get things done.
Where to find documentation for modules you are interested in
The advantages of using modules vs. manually managing a task
Managing state versus managing process, and how it can make your life easier
In this video, you'll learn about some of the most popular (and useful!) Ansible modules. At the end of this video, you'll have a list of modules to dig into, which you can use to manage
Using Package module
Using Files and Directories module
Using System state module
In this video, you'll learn about how Ansible deals with Variables and Facts:
The different levels (namespaces) at which variables can be applied
The most common places to set variables and their benefits/drawbacks
How Ansible gathers facts about a target host, and when you might want to disable this behavior
How you can access facts that Ansible has registered
In this video, you'll see a real-life web application deployment. We'll be setting up Mattermost, an open-source alternative to the popular Slack team-chat application.
Deployed on a single test host
Install and configure the Mattermost application
This video reviews everything we just saw in the application deployment. After watching this video, you'll start to have an intuitive 'real-world' grasp of how a playbook works.
Look at the different modules
Ansible features that were used
While developing Ansible automation, you'll be doing a lot of troubleshooting as part of the process. In this video, I'll show you the most common Ansible features that you'll use for debugging, along with some of the most common Ansible errors you'll encounter.
Doing troubleshooting
Use debugging along with Ansible errors
In this video, you'll learn about the control flow that you can use in your Tasks and Plays. At the end of this video, you'll be comfortable with Ansible iteration constructs like:
with_items
with_dict
with_nested and conditionals like:
when
register
changed_when
failed_when
In addition to control flow in your YAML files, we can also introduce control flow for our file content in your Jinja2 templates.
Introduce control flow for your file content
Use regular Python for control flow and iteration
We have been using YAML to write your Playbooks, Plays, Tasks, and Handlers. Now it's time to dig in for a moment and learn some of the rules you need to keep in mind when working with this markup language.
Learn some of the rules of YAML
Working with this markup language
Task Blocks are one of the useful new features in Ansible 2.0. They allow you to group related tasks together, so you can tie control-flow to larger chunks of actions. This is something that comes in handy for larger actions which are made up of several tasks.
Learn the optional 'rescue' and 'always' block features
Ansible has two built-in execution strategies that affect how it applies tasks to hosts. Knowing whether you want to use the linear (default) strategy or the free strategy can make the difference between completing a deployment in minutes or hours
Difference between using a linear(default) strategy and free strategy
Choosing the right feature
Ansible Galaxy allows you to leverage open-source roles that other people in the Ansible community have created. It can be useful for studying code that others have written, or for quickly getting some functionality that you need without having to write it from scratch.
Install a role from Ansible Galaxy
Use that role in a Playbook
Control where a downloaded role is stored
Remove a role (cleanup)
In this video, I'll cover some of the basic security features. This is essentially a quick list of "best practices" and "things to watch out for." Using Ansible for provisioning, deployment, configuration management, and orchestration does not absolve you of managing the security of your systems...you'll still have to invest thought and planning into how you do this.
Cover some of the basic security features
Using Ansible for provisioning, deployment, configuration management, and orchestration
Ansible can be used to provision services on all major cloud providers: Amazon Web Services (AWS), OpenStack, Google Cloud, Microsoft Azure, and more. There are also Ansible modules for on-premise virtualization and cloud solutions, which makes it really easy to get started.
Use provision services on all major cloud providers
UseAnsible modules for on-premise virtualization and cloud solutions
In this demonstration, you'll see how the Mattermost Deployment playbook was ported to Amazon AWS.
Provisioning and configuring Application Servers on EC2
Provisioning an RDS instance and a replica to handle our database needs
Creating EC2 security groups to manage access and protect our infrastructure
Dynamically creating host groups from the infrastructure we're provisioning
This video will give you a quick taste of Ansible's commercial solution: Ansible Tower. This is a web application wrapper around the core open-source Ansible toolset
Role-based Access Control.
An API that you can integrate into the rest of your automation tooling.
A GUI that allows nontechnical users to leverage Ansible's power.
This video gives us an overview of the entire course.
In this video, we will learn SSH user creation on RHEL 6/CentOS 7 Fedora like system.
SSH Identity Management using Ansible
Discuss how to give sudo access using Ansible system module user
Ansible source code files and lab
In this video, we will learn SSH multiple user deletion on RHEL 6/CentOS 7 Fedora like system.
Deletion of multiple SSH users using Ansible
Ansible system module user
Ansible source code files and lab
In this video, we will learn how to install httpd webserver and harden the httpd server
Installation of httpd webserver, Running httpd webserver using least privilege principle, Httpd certificate configuration
Apply strong ciphers, tls 1.2 protocol , disable SSI and directly listening in the httpd.conf file
Ansible source code example - running the playbook
In this video, we will learn how to disable the server signature and httpd header security
Httpd server click jacking prevention
Httpd server secure cookie, and DoS tuning
In this video, we will get to know how to harden the Operating System with systcl
Securing network configuration
Disable IP forwarding, Ansible Sysctl harden setting
Ansible playbook example of sysctl module
In this video, we will get to know how to harden the Operating System with process hardening
Exec Shield Configuration
Randomized kernel VM region placements
Ansible playbook example for process hardening
In this video, we will get to know how to harden the yum repository
Ansible way gpg check for yum repository
Adding SSH banner for security Policy
Removing legacy services from the OS using Ansible generic package module
In this video, we will learn about rootkit.
clamAV installation
rootkit Detection Packages
Ansible source code for running clamscan
In this video, we will get to know Ansible Tower System Tracking
Configuration of the System Tracking in the Ansible Tower
Comparing the Factor fact Values
Ansible Tower Enterprise Edition features
In this video, we will get to know Ansible Dynamic Inventory
Ansible Dynamic Inventory script for AWS
AWS Group Mapping with the Dynamic Inventory Script
Ansible Playbook run example using the Dynamic Inventory script
In this video, we will get to know Ansible Integrate LDAP with Ansible Tower
Ansible Tower Enterprise Edition LDAP Integration
Ansible Tower Organization Mapping with the LDAP users
Ansible Tower LDAP Troubleshooting
In this video, we will get to know about Security Governance Concept
Ansible Approach to Confidentiality, Integrity and Availability
Ansible AWS EC2 group hardening
Ansible Encrypted Credentials
In this video, we will get to vulnerability scanning and Kernel Patching
Ansible NMAP installation and cron scheduling
Ansible way to patch the OS kernel
Ansible asynchronous
In this video, we will get to know Ansible Support on Windows
Enabling the Microsoft-Windows-Subsystem and Developer Mode
Ubuntu Machine Installation on WSL
Ansible Installation on WSL
In this video, we will get to know How to Manage Windows using Ansible
Ansible winrm package installation in controller node
Enabling winrm service in Windows using PowerShell in target node
Windows Authentication options, Ansible Windows Module
This video provides an overview of the entire course.
A DevOps pipeline can automate software build and deployment, but it must include complex and sophisticated tasks. Ansible can automate those tasks.
Describe the DevOps pipeline
Show how Ansible helps with DevOps
Demonstrate a DevOps pipeline with Ansible
To get the advantages of DevOps, we need to understand what DevOps is and why it is important.
Understand the DevOps culture, tools, and mindset
Discuss the flow from development to production
Understand how monitoring flows data back to development
Correctly setting up our DevOps pipeline is important. Ansible can help us not only in our DevOps pipeline but also in setting up the pipeline itself.
See how Ansible uses playbooks for automation
Set up a Gitlab CI server with Ansible
Install Ansible itself using Ansible
Deploying to a cloud environment such as Amazon Web Services requires us not only to build our software but also to assemble a complete system.
Show the difference between build artifacts and an assembled application
Show how Ansible helps us perform our application assembly
Demonstrate deploying a complete application to Amazon Web Services
Rapid deployment of an application to AWS requires a prebuilt machine image. We can automate this build with Packer and Ansible.
Describe how Packer works to build machine images
Show how Packer integrates with AWS
Show how Packer uses Ansible to provision the machine it is building
As our use of Ansible gets more sophisticated, we need to organize our automation into roles so that we can better maintain and reuse our work.
Use a role from an Ansible playbook file
Download and use a pre-made role from Ansible Galaxy
Build a custom role to install and configure a custom application
The roles we download or build ourselves contain complex information about how to configure a piece of software. Templates and variables allow us to simplify that information to make it easy to modify.
Deploy a configuration file using the Ansible template module
Define variables in templates to better customize our role
Declare variables outside the role to control the role’s behavior
Automating software configuration requires access to secret information like credentials. Ansible Vault will allow us to store that information safely.
Encrypt a variable file with Ansible Vault
Edit a file while it is in an encrypted state
Use an encrypted file as part of an Ansible playbook run
Installing into a cloud environment like AWS is complex because of the dynamic networking involved. Ansible provides tools to simplify this process.
Build an inventory file to manage virtual machines in AWS
Run an Ansible playbook against an AWS virtual machine
See how Ansible can dynamically generate its inventory based on our current AWS configuration
Deploying an application to AWS requires using multiple different resources. Ansible can automate creating and modifying these resources so we can keep our application up-to-date without any downtime.
Understand how AWS rolling updates work
Deploy AWS resources using Ansible
Roll our AWS deployment to a new application version with zero downtime
To test an application that requires multiple virtual machines, we need a tool like Vagrant that is designed to dynamically create and provision virtual machines.
Understand how Vagrant works and what it is for
Configure Vagrant using a Vagrantfile
Use Ansible to provision a Vagrant virtual machine
With Vagrant and Ansible working together, we can build a test environment that deploys an instance of our application, runs tests, and then clean up.
Add tasks to Ansible to perform testing and report results
Configure Ansible via Vagrant using environment variables
Run an integration test with Vagrant and Ansible
To make our integration test as realistic as possible, we are going to deploy our application to the same AWS environment we use for production.
Increase the capabilities of Vagrant using plugins
Install the Vagrant AWS plugin
Configure our Vagrantfile to create dynamic virtual machines in AWS
Our new integration test should run automatically whenever the application changes. We can use Jenkins to launch our integration test.
Create a Jenkinsfile to configure the integration test
Assign the Jenkins job to a build slave with Vagrant and Ansible installed
Run the Jenkins job automatically when the application changes
Ansible provides two separate ways to build Docker containers from an Ansible playbook and we need to understand the advantages of each one.
Demonstrate the Ansible Docker Connector
Demonstrate the Ansible docker_image module
Discuss the advantages of each approach for using Ansible to build Docker containers
Ansible provides a simple and sophisticated solution for running applications based on Docker.
Use the docker_container module to run Docker containers
Use the docker_volume module to create persistent storage for containers
Show how we can use Docker automated host resolution to simplify application configuration
To use our containerized application in a container orchestration environment, we need to push our Docker image to a registry with a unique tag for each build.
Configure Docker push using the docker_login module
Use extra variables to create unique tag names for each build
Use the docker_image module to push to a registry as part of the build
To perform a rolling update of our containerized application running in Docker, we need to understand how to use Docker Compose in our Ansible playbook.
Use the docker_service module to define our application for Docker Compose
Deploy our Docker Compose application using Ansible
Use Ansible to roll our application to a new version with zero downtime
We need an automated test for our containerized application. We can use Docker to create a test environment, making it easy to clean up when our test is done.
Configure Gitlab CI to automatically run our containerized test
Build a test script that uses Docker to create a temporary test environment
Capture the result of the test and return the result to Gitlab CI
To control resources in Kubernetes, we can use Ansible’s k8s_raw module, but we must configure it with the necessary authentication information for the Kubernetes API server.
Show the k8s_raw module in an Ansible playbook
Identify how to specify authentication information for Kubernetes
Demonstrate an Ansible playbook that deploys to Kubernetes
Kubernetes has a unique set of resources that together allow us to deploy an application. We need to understand what resources to use for our application.
Build persistent storage for our application’s database
Create a database deployment and service
Create our application’s deployment and service
Application integration tests can require multiple components to work together. Kubernetes and Ansible can allow us to deploy our application for testing.
Create a unique namespace to keep our test separate
Create a test pod that runs a test version of our application
Execute our test within the test pod and report the results
To deploy our application to Kubernetes using Ansible, we need to understand how each of the Kubernetes resources are declared in the playbook.
Define the persistent storage for our application
Pull in the database and application service definitions from a separate file
Use Ansible’s lookup function to populate variables to properly define our database and application deployments
We need to keep our application running in Kubernetes even while we deploy new versions. We can use Ansible to simplify our Kubernetes rolling updates.
Run our Ansible playbook and review the resulting Kubernetes resources
Expose our application’s service through a port on the Kubernetes host and access it in a browser
Roll our application to a new version and see how Kubernetes updates a pod at a time to avoid downtime
Ansible is a simple, open source, IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs. Designed for multi-tier deployments since day one, Ansible helps take software updates from testing to deployment in a short period of time. It is a great solution for orchestrating DevOps pipelines. Whether you want to manage an entire cloud region, configure network devices, or orchestrate configuration changes across Linux or Windows machines, Ansible is up to the challenge!
This comprehensive 3-in-1 course follows a practical, informative, step-by-step approach to safeguard your system with advanced features of Ansible as well as automate your DevOps and Continuous Delivery software delivery process. You’ll begin with configuring and managing your infrastructure using Ansible Playbooks. You’ll then integrate Ansible with various Cloud Providers such as AWS and OpenStack. Moving further, you’ll build virtual machines to automate testing and deploying your applications. Finally, you’ll create and deploy a containerized application by using Ansible to build custom Docker images.
Towards the end of this course, you'll learn Ansible 2 and perform security automation, CI/CD for software delivery using DevOps with Ansible.
Contents and Overview
This training program includes 3 complete courses, carefully chosen to give you the most comprehensive training possible.
The first course, Ansible 2 for Beginners, covers automating manual tasks for your organization with ease using the highly reliable Ansible 2. In this course, you will get started with Ansible 2.0, including its installation, the problems it solves, and more. We will also walk through creating your very first playbooks. You’ll understand the power of variables and quickly be able to manage environments and implement strategies. You will find out how to integrate with different cloud platforms and be introduced to Ansible Galaxy and Tower, which are Ansible's enterprise tooling for supporting large-scale infrastructure. By the end of this course, you will be well versed in the basics of Ansible and be able to automate your organizational infrastructure easily.
The second course, Ansible 2: Advancements with Security Automation, covers safeguarding your system with advanced features of Ansible 2. The course starts with basic Ansible concepts and later progresses to the advanced features of Ansible 2. You'll start with the usage of Ansible with non-Linux targets, before then moving on to discuss some advanced uses of Ansible Tower. Ansible Tower makes it easy to control the way your infrastructure is configured via configuration definitions and continuous remediation. Next, we will look at secure user management with Ansible managing multiple user and different permissions. We will be closely looking at more complex hardening with STIG and CIS.
The third course, Hands-On DevOps with Ansible, covers automating your DevOps and Continuous Delivery software delivery process using Ansible 2.x. In this course, we show how a DevOps pipeline can speed up your software development. We will use DevOps practices to automate your building and testing environments to push software into production. You will use Ansible to automate your DevOps pipeline. Whether you test and deploy applications on-premise or in the cloud, and whether you build full systems or containers with Docker and Kubernetes, by the end of the course you will be able to develop and deploy reliable applications with speed using Ansible.
Towards the end of this course, you'll learn Ansible 2 and perform security automation, CI/CD for software delivery using DevOps with Ansible.
About the Authors
David Cohen: I've been a system administrator, platform engineer, DevOps engineer, and software developer in everything from small businesses to growing companies (100+ employees) and large tech/engineering firms (10,000+ employees). Most of my work has centered on Linux and UNIX system administration, web security, and software development in Python, Ruby, JavaScript, and Go. I've also done stranger things like helping to design two Tier-4 data centers and being an Infantryman (not at the same time). On my tutorial Linux YouTube channel, I've helped tens of thousands of people learn the basics (and not-so-basics) of system administration, DevOps, and software engineering.
Anish Nath is a developer, author, and a hacker who is willing to contribute and learn. He is an active member of StackOverflow and a DevOps Engineer. He has expertise as a security advocate and security architect. He is experienced in handling security issues such as performing white-hat hacking. He is a community-oriented developer.
Alan Hohn is a Software Architect who primarily works in Java, Go, and Python. He has a lot of experience re-architecting embedded systems and in combining embedded and enterprise approaches. Currently, he works as a Lockheed Martin Fellow encouraging the adoption of virtualization, DevOps, and cloud technologies. This also means that he frequently tries out new technologies and new approaches. He enjoys teaching on technical topics and enjoys hearing from those who find his courses useful. He is employed by Lockheed Martin Rotary and Mission Systems and his personal blog is called Variegated.