Ansible Documentation — Ansible Documentation

Getting started with Ansible — Ansible Documentation


To install Ansible, you will need Python 3.9 and pip.

Check for installation methods depending on your distro.

Installing Ansible — Ansible Documentation


Create an inventory by adding the IP or domain to the /etc/ansible/hosts file.

[myvirtualmachines]
192.0.2.50
192.0.2.51
192.0.2.52

Verify the hosts in your inventory using ansible all --list-hosts

hosts (1):
  192.0.2.50
  192.0.2.51
  192.0.2.52

Setup SSH connections to these hosts so they can use public keys to authenticate.

SSH Key Authentication


Ping the managed nodes to verify your configuration ansible all -m ping

192.0.2.50 | SUCCESS => {
  "ansible_facts": {
    "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
    }
192.0.2.51 | SUCCESS => {
  "ansible_facts": {
    "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
    }
192.0.2.52 | SUCCESS => {
  "ansible_facts": {
    "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
    }