Course Code:
ansiblbesp
Duration:
42 hours
Course Outline:
Introduction to Basic DevOps Principles
- Introduction to basic Infrastructure as Code concepts
- Understanding DevOps methodology. Infrastructure as Code principles and best practices
- Comparing Ansible to other Infrastructure as Code technologies
Ansible Introduction
- Ansible definition
- Exploring modules
- Building a task
- Places to define Ansible vars
- Hosts aka "Inventory"
- Creating a A play
- Looking at the “handler”
- Running a playbook
- Introduction to YAML
- Requirements for connecting to remote hosts
Installation
- Configuration requirements on the control machine
- Python requirements on the host
- Using ansible raw to install Python
Ansible config file and directory structure
- ansible.cfg
- Ansible Inventory
- roles
Ansible Static Inventory
- Defining Hosts and Groups
- Host and Group variables
- Groups of Groups
- Default Groups
YAML
- YAML Gotchas
- YAML Dictionary
- YAML list
- YAML list of dictionaries
- YAML Alternate format
- Relationship to JSON
Ansible Ad hoc commands
- Ad hoc command syntax
- Parallel Shell commands
- Managing packages
- Managing users and groups
- Gathering facts
- ad hoc cheat sheet
Writing a Simple Playbook
- Elements of a well written playbook
- A well-written Ansible play
- Using include files for tasks
- A well-written ansible variable file
- A well-written ansible inventory file
Ansible config file and directory structure
- ansible.cfg
- Best practices concerning directory structures and organization
- Host Inventory and ansible_vars
- Introduction to roles
Key Server Modules to Know
- Understanding modules documentation
- setup / gather_facts
- copy
- apt / yum / pip
- command / shell
- git
- get_url
- debug
- lineinfile
Ansible and Jinja
- What is Jinja2?
- jinja variables
- jinja filters
- jinja tests
- How to use ansible template
- Review of the ansible template documentation
Conditional and Looping Tasks
- Variables and Loops
- Using Complex Variables in Loops
- Variables and Templates
- Using variables in conditions
- Blocks
- Prompts
- Getting variables from the system
- Setting variables in playbooks
- registered variables
- Getting variables from the command line
- Where is the best source to derive variables values?
Ansible for OpenStack and AWS
- Overview of OpenStack
- Understanding the OpenStack client
- What is openstack-sdk (or shade)?
- clouds.yaml
Installing openstack-sdk
- Using openstack-sdk
- OpenStack modules
- os_network
- os_subnet
- os_router
- os_server
- os_server_action
- os_security_group
- os_security_group_rule
Variables and Python
- Jinja Filters for variable manipulation
- Using Python within playbooks for variable manipulation
- Best practices for Variables
- Securing credentials with Ansible Vault
- Encrypting Playbooks with Ansible Vault
Roles and Ansible Galaxy
- Why we need Ansible Roles
- Role Directory Structure
- Using Roles
- Role default variables
- Converting a Playbook to a Role
- Exploring Ansible Galaxy
- Running a role from Ansible Galaxy
Playbook Best Practices
- Directory Layout
- Use Dynamic Inventory With Clouds
- How to Differentiate Staging vs Production
- Group And Host Variables
- Top Level Playbooks Are Separated By Server Type
Ansible Tower / AWX Essentials
- What is Ansible Tower and AWX
- Why you should consider using Jenkins as a replacement for Ansible Tower
- Pushing and pulling playbooks from GitHub
Roles and Galaxy
- Building an Ansible Role
Role Testing with Molecule
- Using a Role within a Playbook (review)
- Pushing Role to GitHub
- Syncing Ansible Galaxy to GitHub
- Making Role Highly Available with Galaxy
- Updating Roles on Galaxy
- Documenting Roles
Advanced Ansible
- Blocks & Rollback
- Asynchronous Actions and Polling
- Check Mode (“Dry Run”)
- Playbook Debugger
- Delegation, Rolling Updates, and Local Actions
- Setting the Environment (and Working With Proxies)
- Working With Language-Specific Version Managers
- Error Handling In Playbooks
- Advanced Syntax
- Working With Plugins
- Prompts
- Tags
- Using Vault in playbooks
- Start and Step
- Playbook Keywords
- Lookups
- Module defaults
Extending the Ansible Library
- Extending Ansible to support (Your Unsupported Ansible Vendor Here)
- Galaxy for new Ansible modules
- GitHub for new Ansible modules
Creating Ansible Modules
- Writing a Python Script
- Adopting a Python Script to function as a Ansible Module
- Pushing our new module to GitHub
- Documenting our new module
- Classes of Ansible Modules available
Ansible and for Enterprise
- Hiding credentials
- Using Ansible Vault
- Collaborating on Playbooks
- Options for logging results
- Options for running Ansible Jobs in an Enterprise