Lab Ansible Beginner: discover Ansible hands-on with SSH, Playbooks, Apache and MariaDB

When we talk about automation, we often refer to AnsibleHowever, it can sometimes seem complex to understand at first glance, and it is not always easy to visualize its concrete usefulness in a computer environment.

Through this first discovery labI propose that you discover Ansible through practice, by carrying out several simple and concrete actions step by step on Linux servers.

You will learn, in particular, to:

  • configure an SSH connection using keys;
  • create an Ansible inventory;
  • test the connectivity of the machines;
  • run your first playbooks;
  • automate Debian updates;
  • deploy Apache;
  • Install and configure MariaDB.

The goal of this lab is to show you that Ansible is not just for large infrastructures, but that it can quickly become a simple, powerful and very useful tool for everyday use.

Lab Instructions

Objective

Discover the basics of Ansible by administering multiple Debian servers from a control server.

Environment available

You have:

  • 1 control server Ansible was installed
  • 2 Debian clients
    • ansible-client1
    • ansible-client2

Login information

  • User: root
  • Password: formation

What you will achieve

  1. Generate an SSH key
  2. Configure customer access
  3. Install Ansible and create a YAML inventory
  4. Test the connection with ansible ping
  5. Create your first playbook
  6. Update the Debian servers
  7. Install Apache on a client
  8. Install MariaDB on another client

Advice

  • Rerun the playbooks several times to observe idempotence.
  • Take the time to read the order reviews.
  • Check the YAML syntax (indentation is important).

Resources