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.
Summary
This lesson covers the installation and setup of Ansible on a controller system. The video demonstrates cloning virtual machines to create controller and target nodes, configuring SSH connectivity between systems, and installing the Ansible package with proper verification. By the end of this part, you'll have a fully functional Ansible installation ready to begin managing remote systems.
Key points
- Clone virtual machines and configure separate controller and target nodes with unique MAC addresses
- Establish SSH connectivity between your Ansible controller system and target systems
- Install Ansible using the appropriate package manager command for your Linux distribution
- Verify successful Ansible installation by running the ansible --version command
- Set up SSH sessions with proper authentication to enable communication between nodes
FAQ
Why do we need separate controller and target machines for Ansible?
The controller is the machine from which you manage others, while target nodes are the remote systems you want to control. This separation allows you to efficiently manage multiple systems from a single control point without needing Ansible installed on every target.
What role does SSH play in Ansible setup?
Ansible relies entirely on SSH for secure communication with remote systems. Establishing SSH connectivity between your controller and target nodes is essential, as Ansible uses SSH to execute commands and transfer data without requiring additional agents on target machines.
How do I confirm that Ansible is installed correctly?
Run the command ansible --version in your terminal. This command displays the installed Ansible version and confirms that the installation was successful and Ansible is accessible from your system PATH.