How to install Ansible

Ansible is an open-source automation tool that offers a straightforward yet effective approach to automate operations like application deployment, configuration management, and IT infrastructure. It enables you to effectively manage and orchestrate complicated systems by allowing you to express your infrastructure as code using a declarative language.

Installation guide

To install Ansible, you can follow these steps:

Choose your operating system

Ansible can be installed on various operating systems, including Linux, macOS, and Windows. Make sure to select the appropriate installation method for your OS.

Install dependencies (if required)

Depending on your operating system, you may need to install specific dependencies before installing Ansible. For example, on a fresh Ubuntu system, you can run the following command to install the necessary packages:

sudo apt-get update
sudo apt-get install software-properties-common
Initial dependencies

The installation process varies depending on your operating system.

Linux

You can install Ansible using the package manager if you're using a Linux distribution, such as Ubuntu or CentOS.

  • For Ubuntu:

sudo apt-get update
sudo apt-get install ansible
Installation commands for Ubuntu
  • For CentOS:

sudo yum install epel-release
sudo yum install ansible
Installation commands for CentOS

macOS

You can install Ansible using Homebrew's package manager if you're using macOS.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ansible
Installation commands for macOS

Windows

For Windows, you can use the Windows Subsystem for Linux (WSL) to install Ansible. First, install WSL by following the instructions provided by Microsoft. Once WSL is installed, you can install Ansible using the above Linux installation steps.

Alternatively, you can install it by following these steps:

  • First, make sure you have Python installed on your Windows system. If not, download the latest version of Python following this installation guide.

  • Next, open the Command Prompt or PowerShell on your Windows system.

  • Install Ansible using Pip by running the following command:

pip install ansible
Installing Ansible

Verify the installation

After installing Ansible, you can verify the installation by running the following command:

ansible --version
Version check

This will display the Ansible version and other information if the installation was successful.

That's it! Ansible should now be installed on your system, and you can start using it for automation and configuration management tasks.

Terminal 1
Terminal
Loading...

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved