dgt_devops06 – Ansible Introduction

Module Title: dgt_devops06 – Ansible Introduction

Module Description:

“dgt_devops06 – Ansible Introduction” is an introduction to configuration management with Ansible. It covers the foundational knowledge needed to understand how IT infrastructure is managed and automated, and the practical ability to direct that automation in natural language.

In this module you never write a playbook by hand. Once you understand inventories, modules, idempotency and roles, you describe to the machine the state you want your servers to reach (“Apache installed, running and enabled on every web server”), let it generate and run the playbook, and then read the YAML line by line to confirm that it does exactly what you asked, nothing more and nothing less, and that a second run changes nothing.

Key Learning Objectives:

  1. Understanding Configuration Management:
  2. Explore the fundamental concepts of configuration management, including its importance in maintaining consistency, reliability, and efficiency in IT environments.
  3. Learn how Ansible fits into the broader landscape of configuration management tools.

  4. Principles of Idempotency:

  5. Learn the principle of idempotency and why it is crucial for automation and configuration management tasks.
  6. Understand how Ansible ensures that repeated executions of a task produce the same result, preventing unintended changes.

  7. Introduction to Ansible:

  8. Get acquainted with Ansible’s architecture, including its agentless design and its use of YAML-based playbooks.
  9. Learn about Ansible modules, inventories and roles, and how they contribute to effective automation strategies.

  10. Playbooks in Natural Language:

  11. Obtain your first Ansible playbook by describing a real-world goal to the machine in plain language, through guided exercises.
  12. Practice checking that the tasks it produces are idempotent and follow good playbook design, and ask for corrections when they do not.

  13. Advanced Concepts:

  14. Study more advanced topics such as dynamic inventories, custom modules, and integrating Ansible with CI/CD pipelines.
  15. Explore how Ansible manages configuration across different environments and platforms, and how to state those differences clearly when you instruct the machine.

Module Content:

  • Module 1: Introduction to Configuration Management
  • Overview of the evolution and benefits of configuration management.
  • Case studies of real implementations.

  • Module 2: Idempotency in Automation

  • Theoretical foundations and practical implications of idempotent operations.
  • Examples illustrating non-idempotent tasks and their impact.

  • Module 3: Getting Started with Ansible

  • Asking the machine to install and set up the Ansible environment, and verifying what it did.
  • Overview of key components: playbooks, modules, roles, and inventories.

  • Module 4: Your First Playbook, Described in Words

  • Step-by-step guide to describing a basic playbook to the machine and reviewing the result.
  • Example of what the machine produces, which you must be able to read and verify:

    “`yaml

    • name: Ensure Apache is installed and running
      hosts: webservers
      become: yes

    tasks:
    – name: Install Apache
    ansible.builtin.yum:
    name: httpd
    state: present

    - name: Start Apache service
      ansible.builtin.service:
        name: httpd
        state: started
        enabled: yes
    

    “`

  • Module 5: Best Practices and Advanced Techniques

  • Strategies for optimizing playbook performance, and how to request them precisely.
  • Tips for keeping automation scalable and secure, and for spotting risky choices in what the machine proposes.

Target Audience:

This module is intended for IT professionals, system administrators, DevOps engineers, and anyone interested in automating infrastructure management with Ansible. Prior knowledge of Linux environments will be beneficial but is not required: what matters is understanding the concepts well enough to give precise instructions and judge the results.

The students can push their exercises to the Academy DevOps & SRE Git project. For this module, create a folder with your username as its name in the following subfolder: https://github.com/Garanti-Del-Talento/gdt_academy