Install and configure ansible on Ubuntu server 18.04

Install and configure Ansible on Ubuntu server 18.04

1. Update Ubuntu repositories and Upgrade.

sudo apt update && sudo apt upgrade

2. Check if python is installed. If installed, go to step 3.

python --version

Install Python. If not Python is not installed, ansible will install by default.

sudo apt install python

3. Install Ansible

winadmin@ansible01:~$ sudo apt install ansible

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following package was automatically installed and is no longer required:

libdumbnet1

Use 'sudo apt autoremove' to remove it.

The following additional packages will be installed:

ieee-data libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-asn1crypto python-certifi

python-cffi-backend python-chardet python-crypto python-cryptography python-enum34 python-httplib2 python-idna

python-ipaddress python-jinja2 python-jmespath python-kerberos python-libcloud python-lockfile python-markupsafe

python-minimal python-netaddr python-openssl python-paramiko python-pkg-resources python-pyasn1 python-requests

python-selinux python-simplejson python-six python-urllib3 python-xmltodict python-yaml python2.7 python2.7-minimal

Suggested packages:

cowsay sshpass python-doc python-tk python-crypto-doc python-cryptography-doc python-cryptography-vectors

python-enum34-doc python-jinja2-doc python-lockfile-doc ipython python-netaddr-docs python-openssl-doc

python-openssl-dbg python-gssapi python-setuptools python-socks python-ntlm python2.7-doc binutils binfmt-support

Recommended packages:

python-winrm

The following NEW packages will be installed:

ansible ieee-data libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-asn1crypto python-certifi

python-cffi-backend python-chardet python-crypto python-cryptography python-enum34 python-httplib2 python-idna

python-ipaddress python-jinja2 python-jmespath python-kerberos python-libcloud python-lockfile python-markupsafe

python-minimal python-netaddr python-openssl python-paramiko python-pkg-resources python-pyasn1 python-requests

python-selinux python-simplejson python-six python-urllib3 python-xmltodict python-yaml python2.7 python2.7-minimal

0 upgraded, 37 newly installed, 0 to remove and 0 not upgraded.

Need to get 12.1 MB of archives.

After this operation, 79.5 MB of additional disk space will be used.

Do you want to continue? [Y/n]Y

4. Once Python is installed, check version.

winadmin@ansible01:~$ ansible --version
ansible 2.5.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/venu/.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 7.4.0]

5. 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@ansible01:~$ ansible localhost -m ping

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match

'all'

localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}


Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on reddit
Share on skype
Share on telegram
Share on whatsapp
Share on email
Share on print

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment