Installing Ansible on Linux
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
In this lesson, you'll learn how to install Ansible on your ansible-controller
VM that you set up in the previous lessons. Additionally, if you are using a Linux-based host computer, the process to install Ansible directly on your host will be similar. By the end of this lesson, you'll have Ansible installed and ready for automation tasks.
Preparing for Installation
Before installing Ansible, make sure your system is up to date. Open a terminal on your Ansible Controller VM or your Linux host and run the following commands:
sudo apt update
sudo apt upgrade
Installing Ansible
- Add Ansible's Official PPA (Personal Package Archive): Ansible can be installed from its official PPA, which often contains the latest version compared to what might be in the default repositories. On your Ansible Controller VM or Linux host, add the PPA by typing:
sudo apt-add-repository ppa:ansible/ansible
- Update Your Package List: After adding the PPA, update your package list to include the newly added repository:
sudo apt update
- Install Ansible: Now, you can install Ansible with:
sudo apt install ansible
This command will install Ansible and any required dependencies.
- Verify the Installation: Once the installation is complete, you can verify it by checking the Ansible version:
ansible --version
This command should return the version of Ansible that was installed, confirming that the installation was successful as shown below:
ansible [core 2.15.8]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/paulh/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/paulh/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True
Conclusion
You now have Ansible installed on your Ansible Controller VM, and possibly on your Linux host. With Ansible installed, you're ready to start exploring automation tasks and learning how to manage your IT infrastructure efficiently. In the upcoming lessons, we'll delve into Ansible's basic commands and start writing our first playbooks.