Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
DevOps: Automate your Infrastructure using Ansible in 9Hours
Rating: 4.3 out of 5(80 ratings)
1,205 students

DevOps: Automate your Infrastructure using Ansible in 9Hours

Deploy applications the right way with the power of Ansible to fasten scalable orchestration, DevOps, and automation
Last updated 11/2018
English

What you'll learn

  • Understand more about Ansible Modules, the structure of Ansible Playbooks, the creation and execution of Ansible playbooks, Ansible Facts, and Jinja2 Templating
  • Manage multiple servers from a single Ansible environment with different and overlapping configuration
  • Create a rapid reliable application deployment
  • Build custom Ansible roles and modules
  • Design every step in the DevOps pipeline, from code check-in to deployment
  • Deploy and configure your own Git repository server to serve as the basis for your DevOps pipeline
  • Build virtual machines to automate testing and deploying your applications
  • Use Ansible with cloud services and containers, such as AWS, Jenkins, Docker, and Kubernetes

Course content

2 sections67 lectures9h 43m total length
  • The Course Overview5:51

    This video gives an overview of the entire course.

  • Ansible Demo6:49

    In this video, we will see a real-world example of what Ansible can do and will set the stage for what the rest of the course has to teach.

    • Describe what Ansible is and the benefits of it

    • Show and describe Ansible demonstration

    • Discuss how Ansible makes software installation easy

  • DevOps and Immutable Infrastructure10:11

    In this video, we will explain how the core DevOps concepts of idempotence and immutable infrastructure are important to understand the use of Ansible.

    • Describe DevOps

    • Describe idempotence and its implications for safety

    • Describe immutable infrastructure and how it enables reliable systems

  • Ansible As a Choice for DevOps7:50

    Ansible is not the only choice for infrastructure automation. In this video we will understand its design approach which helps us understand how it can best be used.

    • Explain that the Ansible has an agentless architecture for ease of use

    • Learn how Ansible uses YAML to record configuration for ease of maintenance

    • Choose simplicity in its approach to automate infrastructure

  • Ansible Install and Remote Management6:47

    Installing Ansible is easy through Python packages. To use it, we also need to understand how to configure SSH and sudo. In this video we will see that.

    • Install Ansible using Python packages

    • Configure SSH and sudo to allow remote machine control

    • Use a ping test to verify remote management with Ansible

  • Running Ansible Commands5:38

    In this video we will use our configured Ansible to run commands across multiple machines.

    • Check status of multiple servers with one Ansible command

    • Install a package on multiple servers with one Ansible command

    • Restart a service on multiple servers with one Ansible command

  • Ansible Inventory File8:37

    In this video we will learn to run Ansible consistently against a set of systems, we need to record a list in the format Ansible expects.

    • Create a plain text inventory file

    • Configure OpenSSH to connect to remote systems

    • Run ansible-playbook to verify our configuration

  • Introduction to Playbooks8:37

    In this video we will learn to specify the list of tasks Ansible should automate, we need to understand playbook files.

    • Understand how tasks and plays make up a playbook

    • Understand how to use YAML syntax to make tasks and plays

    • See how a playbook file is organized

  • Using Tasks and Handlers10:11

    Now that we understand playbook files, in this video we’re ready to see our first example.

    • Understand how to provide parameters to a task

    • See how handlers can be used to run commands only if a task is changed

    • Run a complete Ansible playbook to verify our understanding of tasks and handlers

  • Configuring Systems through the Inventory6:11

    The aim of this video is to record per-system customisation in a place that can be stored in version control.

    • Customize Ansible’s SSH connection to a system

    • Customize how Ansible gets necessary admin privileges

    • See how Ansible can connect to Windows systems and Docker containers

  • Creating Inventory Groups7:25

    In this video, we will see how Ansible can apply the same configuration and plays to multiple systems using groups.

    • Add a system to a group in the inventory file

    • Create a group of groups and add custom configuration to it

    • Configure the playbook to run tasks for a specific group or for all systems

  • Controlling Playbook Runs5:54

    As we add more tasks to an Ansible playbook, it takes longer and longer to run. In this video we will run only part of the playbook so things get executed faster.

    • Limit a playbook run to a specific group or system

    • Limit a playbook run to specific tasks with a tag

    • Combine group limits and tags to target a playbook run

  • Create and Use Roles9:11

    To use Ansible roles effectively, we need to understand what they’re for and how they’re organized.

    • Learn how roles can help organize Ansible automation

    • See the parts of a role and how it’s built

    • See how an Ansible playbook references a role

  • Applying Commonly Used Modules11:14

    Ansible has a lot of modules, and a new user needs to know which ones are most important and how they work.

    • See some commonly used packaging module

    • See some commonly used file modules

    • See some commonly used system modules

  • Getting Roles from Ansible Galaxy7:09

    Ansible Galaxy has many user contributed roles we can reuse. In this video, we will learn how to install and use them.

    • Search for a role on Ansible Galaxy

    • Install and inspect an Ansible Galaxy role

    • Use the Ansible Galaxy role in a playbook

  • Using Role Handlers, Files, and Templates8:31

    To build our own roles, we need to understand how handlers, files, and templates are used in a role.

    • See an example of a role handler

    • See an example of a file in a role

    • See an example of a template in a role

  • Role Dependencies8:23

    Ansible roles often have dependencies on other roles. By configuring these dependencies in a role, we can make our playbooks more concise.

    • Understand how to declare a role as a dependency of another role

    • Understand how to configure a dependency of a role

    • See an example of using the same dependent role multiple times

  • Writing Out Files from a Template10:45

    Ansible templates are powerful but they require us to understand the Jinja2 template language.

    • Review the Ansible template module

    • Perform a basic variable substitution in a template

    • See how template changes cause updates on the system

  • Template Flow Control6:42

    We have sections within a configuration file that need to be turned on or off easily.

    • Understand Jinja2 control statements

    • Use an if statement to include or exclude a section of a template

    • Create compound conditional statements for advanced behavior

  • Repeated Configuration Content12:42

    To make our templates more generic and reusable, we want to move hardcoded lists and data structures to variables.

    • Create a for loop over a YAML list

    • Build a complex YAML data structure and pull values from it into a template

    • Use a Jinja2 macro to more easily repeat similar content

  • Using Defaults and Filters11:19

    To do more advanced data manipulation in a template, we need to understand Jinja2 filters.

    • Use the default filter to handle cases where a variable is not defined

    • Use a join filter to create a comma-separated string from a YAML list

    • Use a map filter to extract individual fields from a complex YAML data structure

  • Defining Reusable Blocks and Inheritance6:50

    Jinja2 blocks and inheritance provide us with a way to create many similar templates from a common base.

    • Create a base template with common content

    • Extend the base template by defining block content

    • Understand how the base and child templates work together to create the output file

  • Using Variables for All Roles10:35

    To create generic and reusable roles, we need to allow role users to configure the role behavior using variables.

    • Describe how Ansible uses variables to configure tasks and templates

    • Discuss the hierarchy for variable values

    • Illustrate how variables can be specified inside and outside the role to modify role behavior

  • Exploring Ansible Facts6:37

    Some configuration might be specific to the system we’re configuring. Ansible provides system-specific facts to help tailor configuration to a system.

    • Show how facts can be used as variables but don’t need to be defined manually

    • Demonstrate running the setup module to see a list of facts

    • Discuss some important facts that Ansible makes available

  • Applying Variables to Groups and Hosts8:54

    By putting systems into groups in Ansible, we can apply configuration to multiple systems at the same time.

    • Show where Ansible looks for group variables

    • Show how Ansible can perform variable substitution into other variables

    • Show where Ansible looks for host-specific variables

  • Using Variables to Control Tasks7:33

    Some tasks may apply only to certain types of systems or only in certain scenarios. Conditional tasks allow us to run tasks only in some cases.

    • Create conditional tasks for different Linux distributions

    • Demonstrate how Ansible runs or skips tasks based on conditionals

    • Look at specific examples for compound task conditions

  • Registering Results in Variables7:46

    To decide whether or how to run a task, we might need to collect dynamic information from a host we’re controlling. Ansible allows us to register results in variables.

    • Register stat information for a file in a variable

    • Show how to use the registered information to control tasks

    • Inspect the detailed information provided

  • Using Lists and Dictionaries in Tasks9:08

    By driving tasks using YAML list and dictionary data structures, we can produce more compact and more configurable roles.

    • Use a YAML list to install multiple packages to a system

    • Use a YAML dictionary to identify multiple configuration files to create on a system

    • Use the YAML dictionary data to drive the contents of the multiple configuration files we created

  • Ansible Vault Purpose8:58

    Installing and configuring software requires us to keep secret information like passwords to use in configuration. We need to put our Ansible content into version control without exposing these secrets.

    • Understand how Ansible works well with version control tools

    • Consider how to handle secret information when using version control

    • See how Ansible Vault encrypts secrets so the data can be safely stored in version control

  • Encrypt and Decrypt Files5:55

    To use Ansible Vault to keep secrets secure, we need to know how to encrypt files. We also need to know how to edit and decrypt files we encrypted.

    • Encrypt a file using Ansible Vault

    • Use the encrypted file when running an Ansible playbook

    • Edit and decrypt a file encrypted by Ansible Vault

  • Create Vault Password Files8:35

    Running Ansible unattended while using Ansible Vault requires us to store our vault password in a file.

    • See a few ways to generate secure passwords and store a password to a file

    • Understand how to keep a password file from being committed to a Git repository

    • See how to use a password file with Ansible commands

  • Encrypting Files for Delivery10:24

    Some secret content, such as a private key file for a web server, is an entire file’s worth of content. We need to know how to store that content securely using Ansible Vault.

    • Discuss using Ansible Vault to encrypt an entire file

    • Show how encrypted file content can be brought in from outside a role

    • Show how to embed an entire file’s content into a YAML variable literal

  • Ansible Module Structure9:16

    Adding new functionality to Ansible involves implementing a custom module in the Python language. We can easily add this custom module to a role.

    • See an Ansible role with a custom module included

    • Run an Ansible playbook that uses a custom module and see the results

    • See the overall structure of a Python file that implements an Ansible custom module

  • Module Arguments and Results8:31

    Our custom module needs to receive data from Ansible, then pass results back. To get parameters from Ansible, we need to let Ansible know what arguments our module supports.

    • Declare a dictionary of module arguments

    • Ask Ansible to build our module parameters using the task data and our dictionary

    • Populate a results object and send it back to Ansible

  • Module Idempotence10:24

    A well-written module will only report change when an actual change occurs on the remote system.

    • Build helper functions to allow our custom module to query current state

    • Use current state to determine if our module needs to make changes

    • Make changes only when required and report back to Ansible whether changes were made

  • Module Check Mode and Module Testing9:25

    To develop our module, we need to be able to run it in a realistic environment without having to create or run an Ansible playbook.

    • See how users can use check mode with our module to make sure their tasks are correct

    • Set up our module file to be run as a top level Python script

    • Create a file with module arguments and a test script to run our module in test mode

  • Module Documentation and Metadata7:43

    A quality module has extensive documentation to show users how to use it. This documentation is also used to generate the Ansible website.

    • Describe our module’s purpose, inputs, and results using documentation

    • Provide examples for how to use our module directly in the module file

    • See how Ansible metadata and documentation is used to generate the Ansible website

  • Ansible Docker Connector8:39

    Ansible can control not just physical and virtual machines, but also Docker containers. This creates new opportunities to use Ansible roles and playbooks in a containerized environment.

    • Understand the difference between virtual machines and containers

    • Run a Docker container

    • Run an Ansible playbook against the Docker container and see the results

  • Ansible with Vagrant8:59

    Vagrant is a useful tool for dynamically creating virtual machines for development and test in an integrated environment. Ansible lets us set up Vagrant virtual machines quickly and easily.

    • Show how Vagrant lets us build a virtual machine from a template box

    • Use Ansible as a provisioner for our Vagrant virtual machine

    • Connect into our Vagrant virtual machine and see the provisioned result

  • Ansible and Vagrant Custom Variables12:07

    Vagrant is a tool for dynamic virtual machines, and when we’re using Ansible to provision Vagrant machines, we want to be able to pass information to Ansible dynamically as well.

    • Pass data from environment variables through Vagrant to Ansible

    • Build a Vagrant file that creates multiple virtual machines

    • Pass dynamic data to Ansible about the Vagrant virtual machines we created

  • Ansible and Packer10:49

    In a horizontally scalable cloud architecture, we need to be able to start many virtual machines with software already installed and configured. Packer and Ansible can work together to build ready-to-use images for the cloud.

    • Understand how Packer builds disk images using Ansible

    • Run Packer to create a new Amazon Machine Image

    • See the resulting AMI ready to use in a cloud environment

  • Using Packer and Ansible to Build Docker Images10:35

    To use Docker effectively, we want a Docker image that already has the result of our Ansible roles applied. Packer can use Ansible to provide this Docker image.

    • Discuss building images using a Docker file versus using Packer and Ansible

    • Review a Packer configuration to create a Docker image

    • Run Packer and Ansible to build the Docker image and see the result

  • Test Your Knowledge

Requirements

  • Familiarity with Ansible and a basic knowledge of system administration will be helpful.

Description

Ansible is a simple 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 models your IT infrastructure by describing how all your systems interrelate, rather than managing one system at a time.

This comprehensive 2-in-1 course is comprehensive, hands-on course with discovery of orchestration, DevOps and automation using Ansible. Explore Ansible with cloud services and its AWS provisioning. Understand infrastructure automation and decide what makes Ansible a good choice for your projects. Get started with Ansible through playbooks and organize the automation of infrastructure tasks by building and using roles from Ansible Galaxy. Use the best DevOps practices to automate your building and testing environments to push your software into production.

This training program includes 2 complete courses, carefully chosen to give you the most comprehensive training possible.

The first course, Hands-On Infrastructure Automation with Ansible, covers practical course for beginners to Ansible and deployment of applications the right way. Use Ansible to automate deployment so you can quickly and reliably run and upgrade your applications. Infrastructure Automation results in cost reduction, productivity, availability, reliability, and performance. Gain real-world experience on your own deployments.

In the second course, Hands-On DevOps with Ansible, you will learn how a DevOps pipeline can speed up your software development. You 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, you will be able to develop and deploy reliable applications with speed using Ansible.

By the end of this course, you’ll be able to create and maintain Ansible playbooks, roles, and custom modules, enabling you to make full use of Ansible as part of a DevOps or automation strategy.

Meet Your Expert(s):

We have the best work of the following esteemed author(s) to ensure that your learning journey is smooth:

  • Alan Hohn is a Software Architect who primarily works with distributed Java. He has had a lot of experience re-architecting embedded systems and in combining embedded and enterprise approaches. Lately he has been doing quite a bit of work with virtualization, DevOps, and cloud technologies. Over the past several years, he has had the opportunity to teach courses on Java. His role and interest also mean that he frequently tries out new libraries and new approaches. His hope is that some of that material will be as useful to others as he has occasionally found it. He is employed by Lockheed Martin Mission Systems and Training and his personal blog is called Variegated.

Who this course is for:

  • This course is aimed at programmers, systems administrators, and DevOps engineers who wish to learn Ansible for application deployment and task automation.