Install and configure Ansible on Ubuntu server 22.04
Installing Ansible on Ubuntu Server 20.04 is simple and straight forward.
Update Ubuntu repositories and Upgrade.
sudo apt update && sudo apt upgrade
Install Ansible
sudo apt install ansible
Check Ansible version
ansible --version
Output:
ansible 2.10.8
config file = None
configured module search path = ['/home/winadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
Check a simple module to check if ansible is working or not. As we have not yet added / updated our inventory file, we can check with localhost.
winadmin@ansible02:~$ ansible localhost -m ping
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
Also check ansible-playbookversion
ansible-playbook 2.10.8
config file = None
configured module search path = ['/home/winadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
Ansible is installed successfully on the server.