![Learning DevOps](https://wfqqreader-1252317822.image.myqcloud.com/cover/384/36698384/b_36698384.jpg)
Installing Ansible with a script
Unlike Terraform, Ansible is not multiplatform and can only be installed on the following OSes: Red Hat, Debian, CentOS, macOS, or any of the BSDs, and its installation is done by a script that differs according to your OS.
For example, to install its latest version on Ubuntu, we must run the following script in a Bash Terminal:
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt-get install ansible
This script updates the packages, installs the software-properties-common dependency, adds the Ansible repository, and finally, installs the latest version of Ansible.
To install Ansible locally on a Windows OS machine, there is no native solution, but it can be installed on the WSL. WSL allows developers who are on a Windows OS to test their scripts and applications directly on their workstation without having to install a virtual machine.
To test whether it has been successfully installed, we can run the following command to check its installed version:
ansible --version
The result of the execution of this command provides some information on the installed version of Ansible, like this:
![](https://epubservercos.yuewen.com/A085E6/19470376308796106/epubprivate/OEBPS/Images/4d1fb489-c5d2-4076-852b-000fb27cc166.png?sign=1738988523-5oVb3OtDdCwfShGO2YYTG1MHrdV6RU8V-0-1201c4eee0c7bfd3d9ffcd93be75d0d4)
To display a list of all Ansible commands and options, execute the ansible command with the --help argument:
ansible --help
The following screenshot shows the execution of this command:
![](https://epubservercos.yuewen.com/A085E6/19470376308796106/epubprivate/OEBPS/Images/5de0f9b8-85ce-45ff-a53c-91d095eb7bfd.png?sign=1738988523-9HSYHSeMDfZFBbAL8t2QZTMLZxANV7hm-0-fe3e354e162213ead6b0fbd3ca104fa3)
The installation of Ansible on a local machine or a remote machine is therefore quite simple and can be automated by a script. If we deploy an infrastructure in Azure, we can also use Ansible as it is integrated into Azure Cloud Shell.
Let's now look at how Ansible is integrated into Azure Cloud Shell.