How to Install Ansible on Ubuntu 18.04
In this tutorial, we will show you how to install ansible and ansible playbook on Ubuntu 18.04. This tutorial will show how to install Ansible version 2 from official ubuntu repositories. Ansible is a very useful tool for the System administrators, DevOps, and also Programmer. Ansible has over 200 new modules.
For those who don’t know Ansible, Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs. Ansible uses a very simple language (YAML, in the form of Ansible Playbooks) that allows you to describe your automation jobs in a way that approaches plain English. Using Ansible you can control multi-server or device at once using a single command. You don’t need to install the client on each server or device.
Ansible version 2 comes with these new feature:
- Greatly expanded support for configuring and managing VMware environments.
- Expanded support for managing Microsoft Windows environments.
- A completely new set of modules for managing OpenStack, the leading open source cloud computing framework, developed in concert with the OpenStack community.
- Substantial improvements to the Docker module and new Docker connection plugin.
- 30 new modules for improving and expanding the support for Amazon Web Services
Prerequisites
Before you begin with this guide, you should at least have basic knowledge of Linux, know basic shell command for Linux, root user, or non-root user account with sudo privileges set up on your server.
Step 1 – Ansible Installation
To begin install ansible on ubuntu 18.04 you need to run these command below:
# apt-get update
# apt-get install ansible
Check installation was successful by using these commands.
# ansible --version
And here’s the output:
# ansible --version
ansible 2.0.0.2
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
Step 2 – Ansible Configuration
To begin using ansible we need to configure ansible to disable host key check. We need to disable it because to prevent host key prompt when we try to connect in the new server.
Edit ansible config file using nano:
# nano /etc/ansible/ansible.cfg
At “[defaults]” section find these line and uncomment:
#host_key_checking = False
Change or uncomment like these:
host_key_checking = False
Congratulation, you have been successfully installed and configure ansible on ubuntu 18.04, to begin using ansible we recommend you visit ansible example page.