Install Ansible on Ubuntu

The installation environment is Ubuntu 19.10.

root@haifeli-ubuntu-2:/etc/ansible# cat /etc/issue
Ubuntu 19.10 \n \l

Upgrade packages

root@haifeli-ubuntu-2:/# sudo apt update
root@haifeli-ubuntu-2:/# sudo apt upgrade

Install Ansible

root@haifeli-ubuntu-2:/# sudo apt-add-repository --yes --update ppa:ansible/ansible
root@haifeli-ubuntu-2:/# sudo apt install ansible

# The following command is optional because Ubuntu 19.10 installed software-properties-common in advance.
root@haifeli-ubuntu-2:/# sudo apt install software-properties-common

Verification

root@haifeli-ubuntu-2:/# ansible --version
ansible 2.9.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Nov  7 2019, 10:07:09) [GCC 9.2.1 20191008]
root@haifeli-ubuntu-2:/#
root@haifeli-ubuntu-2:/#
root@haifeli-ubuntu-2:/# ls /etc/ansible
ansible.cfg  hosts  roles
root@haifeli-ubuntu-2:/#

ansible.cfg: This is the ansible configuration file.
hosts: The hosts file includes the device information( IP address, etc.).

Documentation

Installing Ansible on Ubuntu

https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-ubuntu

Leave a Reply

Your email address will not be published.