Red Hat Ansible resources

2 minute read

Red Hat Ansible resources

Latest

2.8.x version

2.6.x version

Training Classes - Videos

Training - Books and Blogs

Ansible Essentials Notes

What is Ansible and the Ansible Way

  • An automation language that can describe an IT application infrastructure in Ansible Playbooks
  • An automation engine that runs Ansible playbooks
  • Ansible is Simple
    • Human readable automation
    • No special coding skills needed
    • Tasks executed in order
  • Ansible is Powerful
    • Application deployment
    • Configuration management
    • Workflow orchestration
    • Orchestrate the application life cycle
    • Multi-tier orchestration
    • Provisioning
  • Ansible is Agentless
    • Agentless architecture
    • uses OpenSSH & WinRM
    • No agents to exploit or update
    • More efficient & more secure
  • Ansible is Cross platform
    • Agentless support for all major OS variants, physical, virtual, cloud, and network
  • Ansible comes bundled with over 450 modules
  • Has a popular open source community
  • Use Cases
    • Configuration Management
    • Security and Compliance
    • Application Deployment
    • Orchestration
    • Continuous Delivery
    • Provisioning

How Ansible Works

  • Ansible’s Automation Engine
    • Inventory
      • Inventory is a collection of hosts (nodes) against which Ansible can work with
      • Hosts
      • Groups sources
      • Inventory - specific data
      • Static or Dynamic
      • Inventory can from from providers
    • Modules
      • Are tools in the toolkit
      • Python, Powershell, or any language
      • Extend functionality
    • API
    • Plugins
      • Code that plugs into the core engine
      • Adaptability for various uses & platforms
  • commands (run commands modules - special modules)
    • command:
      • Takes the command and executes it
      • The most secure and predictable
    • shell:
      • Executes through a shell like /bin/sh
      • So you can use pipes,etc
    • script:
      • Runs a local script on a remote node after transferring it
    • raw:
      • Executes a command without going through the Ansible module subsystem
  • Variable(s)
    • Ansible can work with metadata from various sources and manage their context in form of variables
    • Variable Precedence ```
      1. Extra Vars
      2. Task Vars (only for the task)
      3. Block vars (only for tasks in the block)
      4. Role and include vars
      5. Play vars_files
      6. Play vars_prompt
      7. Play vars
      8. Set_facts
      9. Registered vars
      10. Host facts
      11. Playbook host_vars
      12. Playbook group_vars
      13. Inventory host_vars
      14. Inventory group_vars
      15. Inventory vars
      16. Role defaults ```
  • Tasks
    • Tasks are executed sequentially
    • Handler Tasks
      • Are special tasks that run at the end of a play if notified by another tasks
  • Plays
    • Plays are ordered sets of tasks to execute host selections from your inventory
  • Playbooks
    • A playbook is a file containing one or more plays
    • Playbooks are written in YAML
  • Roles
    • Roles are packages of closely related Ansible content that can be shared more easily than plays alone