Ansible - 2 - 2 Installation de Ansible part1

With the CentOS template ready, we now clone it into the machines that will form our lab. Right-click the template, choose Clone, name the first copy ansible-controller and tick the option to reinitialise the MAC address so every clone gets its own. On the next page select Linked clone to save disk space — only the differences from the template are stored.

Repeat the same procedure to create ansible-target-1 from the template. Boot both VMs, log in as osboxes and run ifconfig on each to grab their freshly assigned IP addresses. Open two SSH sessions in MobaXterm — one to the controller, one to the target — so you can copy/paste commands easily.

Installing Ansible on the controller

On the controller, install Ansible following the official instructions for CentOS. The package is delivered via yum, so a single command does the trick:

  • Verify the installation with ansible --version. The command should print the version, the configuration file path and the location of installed modules.
  • Confirm SSH connectivity from the controller to the target with ssh osboxes@<target-ip> — accept the fingerprint when prompted, then exit.
  • Target hosts do not need any agent; Ansible drives them through plain SSH.
sudo yum install -y epel-release
sudo yum install -y ansible
ansible --version

That is the magic of Ansible: only the controller needs the binary, and every target only needs SSH and Python available. Our lab is now ready — controller and target talk to each other and Ansible is installed. In the next lesson we will write our first inventory file to describe those hosts to Ansible.